diff --git a/changelog/dscanner.comma-expression.dd b/changelog/dscanner.comma-expression.dd new file mode 100644 index 0000000..51833a3 --- /dev/null +++ b/changelog/dscanner.comma-expression.dd @@ -0,0 +1,3 @@ +Remove the check for comma expression check + e.g. (int a = 3, a + 7) +This check is no longer necessary since comma expression have been removed from the D language. diff --git a/src/dscanner/analysis/comma_expression.d b/src/dscanner/analysis/comma_expression.d deleted file mode 100644 index 551ffd1..0000000 --- a/src/dscanner/analysis/comma_expression.d +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright Brian Schott (Hackerpilot) 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -module dscanner.analysis.comma_expression; - -import dparse.ast; -import dparse.lexer; -import dscanner.analysis.base; -import dsymbol.scope_; - -/** - * Check for uses of the comma expression. - */ -final class CommaExpressionCheck : BaseAnalyzer -{ - alias visit = BaseAnalyzer.visit; - - mixin AnalyzerInfo!"comma_expression_check"; - - this(BaseAnalyzerArguments args) - { - super(args); - } - - override void visit(const Expression ex) - { - if (ex.items.length > 1 && interest > 0) - { - addErrorMessage(ex, KEY, "Avoid using the comma expression."); - } - ex.accept(this); - } - - override void visit(const AssignExpression ex) - { - ++interest; - ex.accept(this); - --interest; - } - - // Dconf 2016 - override void visit(const SynchronizedStatement ss) - { - if (ss.expression !is null) - { - ++interest; - visit(ss.expression); - --interest; - } - visit(ss.statementNoCaseNoDefault); - } - - invariant - { - assert(interest >= 0); - } - - int interest; - - private enum string KEY = "dscanner.suspicious.comma_expression"; -} diff --git a/src/dscanner/analysis/run.d b/src/dscanner/analysis/run.d index e956b14..684c4af 100644 --- a/src/dscanner/analysis/run.d +++ b/src/dscanner/analysis/run.d @@ -47,7 +47,6 @@ import dscanner.analysis.asm_style; import dscanner.analysis.logic_precedence; import dscanner.analysis.stats_collector; import dscanner.analysis.undocumented; -import dscanner.analysis.comma_expression; import dscanner.analysis.function_attributes; import dscanner.analysis.local_imports; import dscanner.analysis.unmodified; @@ -830,10 +829,6 @@ private BaseAnalyzer[] getAnalyzersForModuleAndConfig(string fileName, moduleScope ); - if (moduleName.shouldRun!CommaExpressionCheck(analysisConfig)) - checks ~= new CommaExpressionCheck(args.setSkipTests( - analysisConfig.comma_expression_check == Check.skipTests && !ut)); - if (moduleName.shouldRun!UnmodifiedFinder(analysisConfig)) checks ~= new UnmodifiedFinder(args.setSkipTests( analysisConfig.could_be_immutable_check == Check.skipTests && !ut));