• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

platinumazure / eslint-plugin-qunit / 7857817061

10 Feb 2024 10:29PM UTC coverage: 100.0%. Remained the same
7857817061

Pull #455

github

web-flow
upgrade: Bump eslint-doc-generator from 1.5.2 to 1.6.2

Bumps [eslint-doc-generator](https://github.com/bmish/eslint-doc-generator) from 1.5.2 to 1.6.2.
- [Release notes](https://github.com/bmish/eslint-doc-generator/releases)
- [Changelog](https://github.com/bmish/eslint-doc-generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bmish/eslint-doc-generator/compare/v1.5.2...v1.6.2)

---
updated-dependencies:
- dependency-name: eslint-doc-generator
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #455: upgrade: Bump eslint-doc-generator from 1.5.2 to 1.6.2

653 of 653 branches covered (100.0%)

878 of 878 relevant lines covered (100.0%)

496.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/lib/rules/no-assert-logical-expression.js
1
/**
2
 * @fileoverview forbid binary logical expressions in assert arguments
3
 * @author Kevin Partington
4
 */
5
"use strict";
6

7
//------------------------------------------------------------------------------
8
// Requirements
9
//------------------------------------------------------------------------------
10

11
const utils = require("../utils");
6✔
12

13
//------------------------------------------------------------------------------
14
// Rule Definition
15
//------------------------------------------------------------------------------
16

17
/** @type {import('eslint').Rule.RuleModule} */
18
module.exports = {
6✔
19
    meta: {
20
        type: "suggestion",
21
        docs: {
22
            description: "disallow binary logical expressions in assert arguments",
23
            category: "Best Practices",
24
            recommended: false,
25
            url: "https://github.com/platinumazure/eslint-plugin-qunit/blob/master/docs/rules/no-assert-logical-expression.md"
26
        },
27
        fixable: null,
28
        messages: {
29
            noLogicalOperator: "Do not use '{{operator}}' in assertion arguments."
30
        },
31
        schema: []
32
    },
33

34
    create: function (context) {
35
        const testStack = [];
258✔
36

37
        //----------------------------------------------------------------------
38
        // Helpers
39
        //----------------------------------------------------------------------
40

41
        function checkAndReport(argNodes) {
42
            for (const arg of argNodes) {
252✔
43
                if (arg.type === "LogicalExpression") {
414✔
44
                    context.report({
240✔
45
                        node: arg,
46
                        messageId: "noLogicalOperator",
47
                        data: {
48
                            operator: arg.operator
49
                        }
50
                    });
51
                }
52
            }
53
        }
54

55
        function getAssertVar() {
56
            let result = null;
510✔
57

58
            if (testStack.length > 0) {
510✔
59
                result = testStack[testStack.length - 1].assertContextVar;
504✔
60
            }
61

62
            return result;
510✔
63
        }
64

65
        //----------------------------------------------------------------------
66
        // Public
67
        //----------------------------------------------------------------------
68

69
        return {
258✔
70

71
            "CallExpression": function (node) {
72
                if (utils.isTest(node.callee)) {
510✔
73
                    testStack.push({
252✔
74
                        assertContextVar: utils.getAssertContextNameForTest(node.arguments)
75
                    });
76
                } else if (utils.isAssertion(node.callee, getAssertVar())) {
258✔
77
                    const countNonMessageArgs = Math.max(...utils.getAllowedArities(node.callee, getAssertVar()));
252✔
78
                    checkAndReport(node.arguments.slice(0, countNonMessageArgs));
252✔
79
                }
80
            },
81

82
            "CallExpression:exit": function (node) {
83
                if (utils.isTest(node.callee)) {
510✔
84
                    testStack.pop();
252✔
85
                }
86
            }
87

88
        };
89
    }
90
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc