From ef9bceeb2285424851af178a7d0cdd9104c1cbc2 Mon Sep 17 00:00:00 2001 From: Michal Zgliczynski Date: Tue, 3 Dec 2024 16:49:27 +0100 Subject: [PATCH 1/2] Fix prettier for java files --- .../it/perf/SonarJsPerfBenchmark.java | 11 +- .../javascript/consumer/ConsumerPlugin.java | 5 +- .../javascript/consumer/ConsumerTest.java | 7 +- .../plugin/sonarlint/tests/SonarLintTest.java | 13 +- .../tests/SonarLintTestCodeAnalysisTest.java | 6 +- .../it/plugin/sonarlint/tests/TestUtils.java | 20 +- .../it/plugin/ConsumerPluginTest.java | 15 +- .../javascript/it/plugin/CoverageTest.java | 36 +- .../javascript/it/plugin/CssMetricsTest.java | 95 ++- .../it/plugin/CssStylelintReportTest.java | 7 +- .../javascript/it/plugin/CssTestsUtils.java | 3 +- .../it/plugin/EmbeddedNodeTest.java | 3 +- .../it/plugin/EslintBasedRulesTest.java | 32 +- .../it/plugin/EslintCustomRulesTest.java | 23 +- .../it/plugin/EslintReportTest.java | 6 +- .../javascript/it/plugin/ExpectedIssues.java | 3 +- .../ExternalTSConfigDependencyTest.java | 6 +- .../it/plugin/HtmlSecurityTest.java | 3 +- .../javascript/it/plugin/MetricsTest.java | 3 +- .../it/plugin/MinifiedFilesTest.java | 3 +- .../it/plugin/OrchestratorStarter.java | 10 +- .../javascript/it/plugin/PRAnalysisTest.java | 47 +- .../it/plugin/ReferencedTSConfigTest.java | 5 +- .../it/plugin/SonarJsIntegrationTest.java | 3 +- .../it/plugin/TestCodeAnalysisTest.java | 5 +- .../sonar/javascript/it/plugin/TestUtils.java | 50 +- .../it/plugin/TslintExternalReportTest.java | 3 +- .../it/plugin/TypeCheckerConfigTest.java | 36 +- .../it/plugin/TypeScriptAnalysisTest.java | 68 +- .../it/plugin/TypeScriptRuleTest.java | 21 +- .../javascript/it/plugin/VueAnalysisTest.java | 10 +- .../it/plugin/YamlSecurityTest.java | 3 +- .../it/plugin/assertj/BuildResultAssert.java | 20 +- .../it/plugin/assertj/MeasuresAssert.java | 3 +- .../sonar/javascript/it/CssRulingTest.java | 6 +- .../sonar/javascript/it/JsTsRulingTest.java | 36 +- .../sonar/plugins/javascript/api/Check.java | 1 + .../javascript/api/JsAnalysisConsumer.java | 1 - .../sonar/plugins/javascript/api/JsFile.java | 3 +- .../plugins/javascript/api/estree/ESTree.java | 568 +++++++++++--- .../api/CustomRuleRepositoryTest.java | 5 +- .../javascript/api/EslintBasedCheckTest.java | 5 +- .../javascript/api/estree/ESTreeTest.java | 1 - .../javascript/bridge/AnalysisMode.java | 5 +- .../javascript/bridge/BridgeServer.java | 189 +++-- .../javascript/bridge/BridgeServerConfig.java | 13 +- .../javascript/bridge/BridgeServerImpl.java | 36 +- .../javascript/bridge/ESTreeFactory.java | 709 ++++++++++++------ .../javascript/bridge/EmbeddedNode.java | 16 +- .../javascript/bridge/Environment.java | 11 +- .../javascript/bridge/FormDataUtils.java | 3 +- .../sonar/plugins/javascript/bridge/Http.java | 11 +- .../javascript/bridge/RulesBundles.java | 28 +- .../javascript/bridge/TsConfigFile.java | 5 +- .../nodejs/NodeCommandBuilderImpl.java | 3 +- .../javascript/nodejs/StreamConsumer.java | 16 +- .../javascript/bridge/AnalysisModeTest.java | 27 +- .../bridge/BridgeServerImplTest.java | 270 ++++--- .../javascript/bridge/BundleImplTest.java | 4 +- .../javascript/bridge/ESTreeFactoryTest.java | 374 ++++----- .../javascript/bridge/EmbeddedNodeTest.java | 28 +- .../javascript/bridge/EslintRuleTest.java | 8 +- .../javascript/bridge/FormDataUtilsTest.java | 41 +- .../bridge/NodeDeprecationWarningTest.java | 9 +- .../javascript/bridge/PluginInfoTest.java | 1 - .../javascript/bridge/RulesBundlesTest.java | 8 +- .../javascript/nodejs/NodeCommandTest.java | 75 +- .../org/sonar/css/StylelintReportSensor.java | 4 +- .../java/org/sonar/css/metrics/CssLexer.java | 3 +- .../css/rules/SelectorTypeNoUnknown.java | 8 +- .../org/sonar/css/CssRulesDefinitionTest.java | 5 +- .../sonar/css/StylelintReportSensorTest.java | 27 +- .../java/org/sonar/css/TestActiveRules.java | 5 +- .../css/metrics/CssMetricSensorTest.java | 26 +- .../java/org/sonar/css/rules/CssRuleTest.java | 58 +- .../org/sonar/javascript/checks/S100.java | 2 - .../org/sonar/javascript/checks/S101.java | 2 - .../org/sonar/javascript/checks/S103.java | 2 - .../org/sonar/javascript/checks/S104.java | 6 +- .../org/sonar/javascript/checks/S105.java | 5 +- .../org/sonar/javascript/checks/S106.java | 2 - .../org/sonar/javascript/checks/S1066.java | 5 +- .../org/sonar/javascript/checks/S1067.java | 6 +- .../org/sonar/javascript/checks/S1068.java | 5 +- .../org/sonar/javascript/checks/S107.java | 6 +- .../org/sonar/javascript/checks/S1077.java | 5 +- .../org/sonar/javascript/checks/S108.java | 2 - .../org/sonar/javascript/checks/S1082.java | 5 +- .../org/sonar/javascript/checks/S109.java | 2 - .../org/sonar/javascript/checks/S1090.java | 5 +- .../org/sonar/javascript/checks/S1105.java | 2 - .../org/sonar/javascript/checks/S1110.java | 5 +- .../org/sonar/javascript/checks/S1116.java | 5 +- .../org/sonar/javascript/checks/S1117.java | 2 - .../org/sonar/javascript/checks/S1119.java | 5 +- .../org/sonar/javascript/checks/S1121.java | 5 +- .../org/sonar/javascript/checks/S1125.java | 5 +- .../org/sonar/javascript/checks/S1126.java | 5 +- .../org/sonar/javascript/checks/S1128.java | 5 +- .../org/sonar/javascript/checks/S113.java | 2 - .../org/sonar/javascript/checks/S1131.java | 5 +- .../org/sonar/javascript/checks/S1134.java | 5 +- .../org/sonar/javascript/checks/S1135.java | 5 +- .../org/sonar/javascript/checks/S1143.java | 5 +- .../org/sonar/javascript/checks/S1154.java | 5 +- .../org/sonar/javascript/checks/S117.java | 2 - .../org/sonar/javascript/checks/S1172.java | 5 +- .../org/sonar/javascript/checks/S1186.java | 2 - .../org/sonar/javascript/checks/S1192.java | 1 + .../org/sonar/javascript/checks/S1199.java | 5 +- .../org/sonar/javascript/checks/S121.java | 5 +- .../org/sonar/javascript/checks/S1219.java | 5 +- .../org/sonar/javascript/checks/S122.java | 5 +- .../org/sonar/javascript/checks/S1226.java | 5 +- .../org/sonar/javascript/checks/S124.java | 6 +- .../org/sonar/javascript/checks/S125.java | 5 +- .../org/sonar/javascript/checks/S126.java | 5 +- .../org/sonar/javascript/checks/S1264.java | 5 +- .../org/sonar/javascript/checks/S128.java | 5 +- .../org/sonar/javascript/checks/S1291.java | 4 +- .../org/sonar/javascript/checks/S1301.java | 5 +- .../org/sonar/javascript/checks/S131.java | 5 +- .../org/sonar/javascript/checks/S1313.java | 5 +- .../org/sonar/javascript/checks/S1314.java | 5 +- .../org/sonar/javascript/checks/S1321.java | 5 +- .../org/sonar/javascript/checks/S134.java | 2 - .../org/sonar/javascript/checks/S135.java | 5 +- .../org/sonar/javascript/checks/S138.java | 6 +- .../org/sonar/javascript/checks/S139.java | 2 - .../org/sonar/javascript/checks/S1438.java | 5 +- .../org/sonar/javascript/checks/S1439.java | 5 +- .../org/sonar/javascript/checks/S1440.java | 2 - .../org/sonar/javascript/checks/S1441.java | 2 - .../org/sonar/javascript/checks/S1442.java | 5 +- .../org/sonar/javascript/checks/S1444.java | 5 +- .../org/sonar/javascript/checks/S1451.java | 2 - .../org/sonar/javascript/checks/S1472.java | 5 +- .../org/sonar/javascript/checks/S1479.java | 2 - .../org/sonar/javascript/checks/S1481.java | 5 +- .../org/sonar/javascript/checks/S1488.java | 5 +- .../org/sonar/javascript/checks/S1515.java | 5 +- .../org/sonar/javascript/checks/S1516.java | 5 +- .../org/sonar/javascript/checks/S1523.java | 5 +- .../org/sonar/javascript/checks/S1525.java | 5 +- .../org/sonar/javascript/checks/S1526.java | 5 +- .../org/sonar/javascript/checks/S1527.java | 5 +- .../org/sonar/javascript/checks/S1528.java | 5 +- .../org/sonar/javascript/checks/S1529.java | 5 +- .../org/sonar/javascript/checks/S1530.java | 5 +- .../org/sonar/javascript/checks/S1533.java | 5 +- .../org/sonar/javascript/checks/S1534.java | 5 +- .../org/sonar/javascript/checks/S1535.java | 5 +- .../org/sonar/javascript/checks/S1536.java | 5 +- .../org/sonar/javascript/checks/S1537.java | 5 +- .../org/sonar/javascript/checks/S1539.java | 2 - .../org/sonar/javascript/checks/S1541Js.java | 6 +- .../org/sonar/javascript/checks/S1541Ts.java | 5 +- .../org/sonar/javascript/checks/S1607.java | 5 +- .../org/sonar/javascript/checks/S1656.java | 5 +- .../org/sonar/javascript/checks/S1751.java | 5 +- .../org/sonar/javascript/checks/S1763.java | 5 +- .../org/sonar/javascript/checks/S1764.java | 5 +- .../org/sonar/javascript/checks/S1774.java | 5 +- .../org/sonar/javascript/checks/S1788.java | 5 +- .../org/sonar/javascript/checks/S1821.java | 5 +- .../org/sonar/javascript/checks/S1848.java | 5 +- .../org/sonar/javascript/checks/S1854.java | 5 +- .../org/sonar/javascript/checks/S1862.java | 5 +- .../org/sonar/javascript/checks/S1871.java | 5 +- .../org/sonar/javascript/checks/S1874.java | 5 +- .../org/sonar/javascript/checks/S1940.java | 5 +- .../org/sonar/javascript/checks/S1994.java | 5 +- .../org/sonar/javascript/checks/S2004.java | 6 +- .../org/sonar/javascript/checks/S2068.java | 5 +- .../org/sonar/javascript/checks/S2077.java | 5 +- .../org/sonar/javascript/checks/S2092.java | 5 +- .../org/sonar/javascript/checks/S2094.java | 2 - .../org/sonar/javascript/checks/S2123.java | 5 +- .../org/sonar/javascript/checks/S2137.java | 5 +- .../org/sonar/javascript/checks/S2138.java | 5 +- .../org/sonar/javascript/checks/S2187.java | 5 +- .../org/sonar/javascript/checks/S2189.java | 5 +- .../org/sonar/javascript/checks/S2201.java | 5 +- .../org/sonar/javascript/checks/S2208.java | 5 +- .../org/sonar/javascript/checks/S2234.java | 5 +- .../org/sonar/javascript/checks/S2245.java | 5 +- .../org/sonar/javascript/checks/S2251.java | 5 +- .../org/sonar/javascript/checks/S2255.java | 5 +- .../org/sonar/javascript/checks/S2259.java | 5 +- .../org/sonar/javascript/checks/S2301.java | 5 +- .../org/sonar/javascript/checks/S2310.java | 5 +- .../org/sonar/javascript/checks/S2376.java | 6 +- .../org/sonar/javascript/checks/S2392.java | 5 +- .../org/sonar/javascript/checks/S2424.java | 5 +- .../org/sonar/javascript/checks/S2427.java | 5 +- .../org/sonar/javascript/checks/S2428.java | 5 +- .../org/sonar/javascript/checks/S2430.java | 2 - .../org/sonar/javascript/checks/S2432.java | 5 +- .../org/sonar/javascript/checks/S2486.java | 5 +- .../org/sonar/javascript/checks/S2589.java | 5 +- .../org/sonar/javascript/checks/S2598.java | 5 +- .../org/sonar/javascript/checks/S2612.java | 5 +- .../org/sonar/javascript/checks/S2639.java | 5 +- .../org/sonar/javascript/checks/S2681.java | 5 +- .../org/sonar/javascript/checks/S2685.java | 5 +- .../org/sonar/javascript/checks/S2688.java | 5 +- .../org/sonar/javascript/checks/S2692.java | 5 +- .../org/sonar/javascript/checks/S2699.java | 5 +- .../org/sonar/javascript/checks/S2703.java | 5 +- .../org/sonar/javascript/checks/S2737.java | 5 +- .../org/sonar/javascript/checks/S2755.java | 5 +- .../org/sonar/javascript/checks/S2757.java | 5 +- .../org/sonar/javascript/checks/S2814.java | 2 - .../org/sonar/javascript/checks/S2817.java | 5 +- .../org/sonar/javascript/checks/S2819.java | 5 +- .../org/sonar/javascript/checks/S2870.java | 5 +- .../org/sonar/javascript/checks/S2871.java | 5 +- .../org/sonar/javascript/checks/S2933.java | 5 +- .../org/sonar/javascript/checks/S2966.java | 5 +- .../org/sonar/javascript/checks/S2970.java | 5 +- .../org/sonar/javascript/checks/S2990.java | 5 +- .../org/sonar/javascript/checks/S2999.java | 4 +- .../org/sonar/javascript/checks/S3001.java | 5 +- .../org/sonar/javascript/checks/S3003.java | 5 +- .../org/sonar/javascript/checks/S3257.java | 5 +- .../org/sonar/javascript/checks/S3317.java | 5 +- .../org/sonar/javascript/checks/S3330.java | 5 +- .../org/sonar/javascript/checks/S3353.java | 2 - .../org/sonar/javascript/checks/S3358.java | 5 +- .../org/sonar/javascript/checks/S3402.java | 5 +- .../org/sonar/javascript/checks/S3403.java | 5 +- .../org/sonar/javascript/checks/S3498.java | 5 +- .../org/sonar/javascript/checks/S3499.java | 5 +- .../org/sonar/javascript/checks/S3500.java | 5 +- .../org/sonar/javascript/checks/S3504.java | 5 +- .../org/sonar/javascript/checks/S3512.java | 5 +- .../org/sonar/javascript/checks/S3513.java | 5 +- .../org/sonar/javascript/checks/S3514.java | 5 +- .../org/sonar/javascript/checks/S3516.java | 5 +- .../org/sonar/javascript/checks/S3523.java | 4 +- .../org/sonar/javascript/checks/S3524.java | 2 - .../org/sonar/javascript/checks/S3525.java | 5 +- .../org/sonar/javascript/checks/S3531.java | 5 +- .../org/sonar/javascript/checks/S3533.java | 5 +- .../org/sonar/javascript/checks/S3579.java | 5 +- .../org/sonar/javascript/checks/S3616.java | 5 +- .../org/sonar/javascript/checks/S3626.java | 5 +- .../org/sonar/javascript/checks/S3686.java | 5 +- .../org/sonar/javascript/checks/S3696.java | 5 +- .../org/sonar/javascript/checks/S3699.java | 5 +- .../org/sonar/javascript/checks/S3723.java | 2 - .../org/sonar/javascript/checks/S3735.java | 5 +- .../org/sonar/javascript/checks/S3757.java | 5 +- .../org/sonar/javascript/checks/S3758.java | 5 +- .../org/sonar/javascript/checks/S3760.java | 5 +- .../org/sonar/javascript/checks/S3776.java | 2 - .../org/sonar/javascript/checks/S3782.java | 5 +- .../org/sonar/javascript/checks/S3785.java | 5 +- .../org/sonar/javascript/checks/S3786.java | 5 +- .../org/sonar/javascript/checks/S3796.java | 5 +- .../org/sonar/javascript/checks/S3798.java | 5 +- .../org/sonar/javascript/checks/S3799.java | 5 +- .../org/sonar/javascript/checks/S3800.java | 5 +- .../org/sonar/javascript/checks/S3801.java | 5 +- .../org/sonar/javascript/checks/S3812.java | 5 +- .../org/sonar/javascript/checks/S3827.java | 5 +- .../org/sonar/javascript/checks/S3834.java | 5 +- .../org/sonar/javascript/checks/S3854.java | 5 +- .../org/sonar/javascript/checks/S3863.java | 5 +- .../org/sonar/javascript/checks/S3923.java | 5 +- .../org/sonar/javascript/checks/S3972.java | 5 +- .../org/sonar/javascript/checks/S3973.java | 5 +- .../org/sonar/javascript/checks/S3981.java | 5 +- .../org/sonar/javascript/checks/S3984.java | 5 +- .../org/sonar/javascript/checks/S4023.java | 2 - .../org/sonar/javascript/checks/S4030.java | 5 +- .../org/sonar/javascript/checks/S4036.java | 5 +- .../org/sonar/javascript/checks/S4043.java | 5 +- .../org/sonar/javascript/checks/S4084.java | 5 +- .../org/sonar/javascript/checks/S4123.java | 5 +- .../org/sonar/javascript/checks/S4124.java | 5 +- .../org/sonar/javascript/checks/S4125.java | 5 +- .../org/sonar/javascript/checks/S4136.java | 5 +- .../org/sonar/javascript/checks/S4137.java | 2 - .../org/sonar/javascript/checks/S4138.java | 5 +- .../org/sonar/javascript/checks/S4139.java | 5 +- .../org/sonar/javascript/checks/S4140.java | 5 +- .../org/sonar/javascript/checks/S4143.java | 5 +- .../org/sonar/javascript/checks/S4144.java | 2 - .../org/sonar/javascript/checks/S4156.java | 5 +- .../org/sonar/javascript/checks/S4157.java | 5 +- .../org/sonar/javascript/checks/S4158.java | 5 +- .../org/sonar/javascript/checks/S4165.java | 5 +- .../org/sonar/javascript/checks/S4204.java | 5 +- .../org/sonar/javascript/checks/S4275.java | 5 +- .../org/sonar/javascript/checks/S4322.java | 5 +- .../org/sonar/javascript/checks/S4323.java | 5 +- .../org/sonar/javascript/checks/S4324.java | 5 +- .../org/sonar/javascript/checks/S4325.java | 5 +- .../org/sonar/javascript/checks/S4326.java | 5 +- .../org/sonar/javascript/checks/S4327.java | 2 - .../org/sonar/javascript/checks/S4328.java | 8 +- .../org/sonar/javascript/checks/S4335.java | 5 +- .../org/sonar/javascript/checks/S4423.java | 5 +- .../org/sonar/javascript/checks/S4426.java | 5 +- .../org/sonar/javascript/checks/S4502.java | 5 +- .../org/sonar/javascript/checks/S4507.java | 5 +- .../org/sonar/javascript/checks/S4524.java | 5 +- .../org/sonar/javascript/checks/S4619.java | 5 +- .../org/sonar/javascript/checks/S4621.java | 5 +- .../org/sonar/javascript/checks/S4622.java | 6 +- .../org/sonar/javascript/checks/S4623.java | 5 +- .../org/sonar/javascript/checks/S4624.java | 5 +- .../org/sonar/javascript/checks/S4634.java | 5 +- .../org/sonar/javascript/checks/S4721.java | 5 +- .../org/sonar/javascript/checks/S4782.java | 5 +- .../org/sonar/javascript/checks/S4784.java | 5 +- .../org/sonar/javascript/checks/S4787.java | 5 +- .../org/sonar/javascript/checks/S4790.java | 5 +- .../org/sonar/javascript/checks/S4798.java | 5 +- .../org/sonar/javascript/checks/S4817.java | 5 +- .../org/sonar/javascript/checks/S4818.java | 5 +- .../org/sonar/javascript/checks/S4822.java | 5 +- .../org/sonar/javascript/checks/S4823.java | 5 +- .../org/sonar/javascript/checks/S4829.java | 5 +- .../org/sonar/javascript/checks/S4830.java | 5 +- .../org/sonar/javascript/checks/S5042.java | 5 +- .../org/sonar/javascript/checks/S5122.java | 5 +- .../org/sonar/javascript/checks/S5148.java | 5 +- .../org/sonar/javascript/checks/S5247.java | 5 +- .../org/sonar/javascript/checks/S5254.java | 5 +- .../org/sonar/javascript/checks/S5256.java | 5 +- .../org/sonar/javascript/checks/S5257.java | 5 +- .../org/sonar/javascript/checks/S5260.java | 5 +- .../org/sonar/javascript/checks/S5264.java | 5 +- .../org/sonar/javascript/checks/S5332.java | 5 +- .../org/sonar/javascript/checks/S5443.java | 5 +- .../org/sonar/javascript/checks/S5527.java | 5 +- .../org/sonar/javascript/checks/S5542.java | 5 +- .../org/sonar/javascript/checks/S5547.java | 5 +- .../org/sonar/javascript/checks/S5604.java | 6 +- .../org/sonar/javascript/checks/S5659.java | 5 +- .../org/sonar/javascript/checks/S5689.java | 5 +- .../org/sonar/javascript/checks/S5691.java | 5 +- .../org/sonar/javascript/checks/S5693.java | 9 +- .../org/sonar/javascript/checks/S5725.java | 5 +- .../org/sonar/javascript/checks/S5728.java | 5 +- .../org/sonar/javascript/checks/S5730.java | 5 +- .../org/sonar/javascript/checks/S5732.java | 5 +- .../org/sonar/javascript/checks/S5734.java | 5 +- .../org/sonar/javascript/checks/S5736.java | 5 +- .../org/sonar/javascript/checks/S5739.java | 5 +- .../org/sonar/javascript/checks/S5742.java | 5 +- .../org/sonar/javascript/checks/S5743.java | 5 +- .../org/sonar/javascript/checks/S5757.java | 5 +- .../org/sonar/javascript/checks/S5759.java | 5 +- .../org/sonar/javascript/checks/S5842.java | 5 +- .../org/sonar/javascript/checks/S5843.java | 6 +- .../org/sonar/javascript/checks/S5850.java | 5 +- .../org/sonar/javascript/checks/S5852.java | 5 +- .../org/sonar/javascript/checks/S5856.java | 5 +- .../org/sonar/javascript/checks/S5860.java | 5 +- .../org/sonar/javascript/checks/S5863.java | 5 +- .../org/sonar/javascript/checks/S5867.java | 5 +- .../org/sonar/javascript/checks/S5868.java | 5 +- .../org/sonar/javascript/checks/S5869.java | 5 +- .../org/sonar/javascript/checks/S5876.java | 5 +- .../org/sonar/javascript/checks/S5958.java | 5 +- .../org/sonar/javascript/checks/S5973.java | 5 +- .../org/sonar/javascript/checks/S6019.java | 5 +- .../org/sonar/javascript/checks/S6035.java | 5 +- .../org/sonar/javascript/checks/S6079.java | 5 +- .../org/sonar/javascript/checks/S6080.java | 5 +- .../org/sonar/javascript/checks/S6092.java | 5 +- .../org/sonar/javascript/checks/S6245.java | 5 +- .../org/sonar/javascript/checks/S6249.java | 5 +- .../org/sonar/javascript/checks/S6252.java | 5 +- .../org/sonar/javascript/checks/S6265.java | 5 +- .../org/sonar/javascript/checks/S6268.java | 5 +- .../org/sonar/javascript/checks/S6270.java | 5 +- .../org/sonar/javascript/checks/S6275.java | 5 +- .../org/sonar/javascript/checks/S6281.java | 5 +- .../org/sonar/javascript/checks/S6299.java | 5 +- .../org/sonar/javascript/checks/S6302.java | 5 +- .../org/sonar/javascript/checks/S6303.java | 5 +- .../org/sonar/javascript/checks/S6304.java | 5 +- .../org/sonar/javascript/checks/S6308.java | 5 +- .../org/sonar/javascript/checks/S6317.java | 5 +- .../org/sonar/javascript/checks/S6319.java | 5 +- .../org/sonar/javascript/checks/S6321.java | 5 +- .../org/sonar/javascript/checks/S6323.java | 5 +- .../org/sonar/javascript/checks/S6324.java | 5 +- .../org/sonar/javascript/checks/S6325.java | 5 +- .../org/sonar/javascript/checks/S6326.java | 5 +- .../org/sonar/javascript/checks/S6327.java | 5 +- .../org/sonar/javascript/checks/S6328.java | 5 +- .../org/sonar/javascript/checks/S6329.java | 5 +- .../org/sonar/javascript/checks/S6330.java | 5 +- .../org/sonar/javascript/checks/S6331.java | 5 +- .../org/sonar/javascript/checks/S6332.java | 5 +- .../org/sonar/javascript/checks/S6333.java | 5 +- .../org/sonar/javascript/checks/S6351.java | 5 +- .../org/sonar/javascript/checks/S6353.java | 5 +- .../org/sonar/javascript/checks/S6397.java | 5 +- .../org/sonar/javascript/checks/S6418.java | 5 +- .../org/sonar/javascript/checks/S6426.java | 5 +- .../org/sonar/javascript/checks/S6435.java | 5 +- .../org/sonar/javascript/checks/S6438.java | 5 +- .../org/sonar/javascript/checks/S6439.java | 5 +- .../org/sonar/javascript/checks/S6440.java | 5 +- .../org/sonar/javascript/checks/S6441.java | 5 +- .../org/sonar/javascript/checks/S6442.java | 5 +- .../org/sonar/javascript/checks/S6443.java | 5 +- .../org/sonar/javascript/checks/S6477.java | 5 +- .../org/sonar/javascript/checks/S6478.java | 5 +- .../org/sonar/javascript/checks/S6479.java | 5 +- .../org/sonar/javascript/checks/S6480.java | 2 - .../org/sonar/javascript/checks/S6481.java | 5 +- .../org/sonar/javascript/checks/S6486.java | 5 +- .../org/sonar/javascript/checks/S6509.java | 5 +- .../org/sonar/javascript/checks/S6522.java | 5 +- .../org/sonar/javascript/checks/S6523.java | 5 +- .../org/sonar/javascript/checks/S6534.java | 5 +- .../org/sonar/javascript/checks/S6535.java | 5 +- .../org/sonar/javascript/checks/S6544.java | 2 - .../org/sonar/javascript/checks/S6550.java | 2 - .../org/sonar/javascript/checks/S6551.java | 5 +- .../org/sonar/javascript/checks/S6557.java | 5 +- .../org/sonar/javascript/checks/S6564.java | 5 +- .../org/sonar/javascript/checks/S6565.java | 5 +- .../org/sonar/javascript/checks/S6568.java | 5 +- .../org/sonar/javascript/checks/S6569.java | 5 +- .../org/sonar/javascript/checks/S6571.java | 5 +- .../org/sonar/javascript/checks/S6572.java | 5 +- .../org/sonar/javascript/checks/S6578.java | 5 +- .../org/sonar/javascript/checks/S6582.java | 5 +- .../org/sonar/javascript/checks/S6583.java | 5 +- .../org/sonar/javascript/checks/S6590.java | 5 +- .../org/sonar/javascript/checks/S6594.java | 5 +- .../org/sonar/javascript/checks/S6598.java | 5 +- .../org/sonar/javascript/checks/S6606.java | 2 - .../org/sonar/javascript/checks/S6627.java | 4 +- .../org/sonar/javascript/checks/S6635.java | 5 +- .../org/sonar/javascript/checks/S6637.java | 5 +- .../org/sonar/javascript/checks/S6638.java | 5 +- .../org/sonar/javascript/checks/S6643.java | 5 +- .../org/sonar/javascript/checks/S6644.java | 2 - .../org/sonar/javascript/checks/S6645.java | 5 +- .../org/sonar/javascript/checks/S6647.java | 5 +- .../org/sonar/javascript/checks/S6650.java | 5 +- .../org/sonar/javascript/checks/S6653.java | 5 +- .../org/sonar/javascript/checks/S6654.java | 5 +- .../org/sonar/javascript/checks/S6657.java | 5 +- .../org/sonar/javascript/checks/S6660.java | 5 +- .../org/sonar/javascript/checks/S6661.java | 5 +- .../org/sonar/javascript/checks/S6666.java | 5 +- .../org/sonar/javascript/checks/S6671.java | 5 +- .../org/sonar/javascript/checks/S6676.java | 5 +- .../org/sonar/javascript/checks/S6679.java | 5 +- .../org/sonar/javascript/checks/S6746.java | 5 +- .../org/sonar/javascript/checks/S6747.java | 2 - .../org/sonar/javascript/checks/S6748.java | 5 +- .../org/sonar/javascript/checks/S6749.java | 2 - .../org/sonar/javascript/checks/S6750.java | 5 +- .../org/sonar/javascript/checks/S6754.java | 2 - .../org/sonar/javascript/checks/S6756.java | 5 +- .../org/sonar/javascript/checks/S6757.java | 5 +- .../org/sonar/javascript/checks/S6759.java | 5 +- .../org/sonar/javascript/checks/S6761.java | 5 +- .../org/sonar/javascript/checks/S6763.java | 5 +- .../org/sonar/javascript/checks/S6766.java | 2 - .../org/sonar/javascript/checks/S6767.java | 5 +- .../org/sonar/javascript/checks/S6770.java | 5 +- .../org/sonar/javascript/checks/S6772.java | 5 +- .../org/sonar/javascript/checks/S6774.java | 5 +- .../org/sonar/javascript/checks/S6775.java | 5 +- .../org/sonar/javascript/checks/S6788.java | 5 +- .../org/sonar/javascript/checks/S6789.java | 5 +- .../org/sonar/javascript/checks/S6790.java | 5 +- .../org/sonar/javascript/checks/S6791.java | 2 - .../org/sonar/javascript/checks/S6793.java | 5 +- .../org/sonar/javascript/checks/S6807.java | 5 +- .../org/sonar/javascript/checks/S6811.java | 5 +- .../org/sonar/javascript/checks/S6819.java | 5 +- .../org/sonar/javascript/checks/S6821.java | 2 - .../org/sonar/javascript/checks/S6822.java | 5 +- .../org/sonar/javascript/checks/S6823.java | 5 +- .../org/sonar/javascript/checks/S6824.java | 5 +- .../org/sonar/javascript/checks/S6825.java | 5 +- .../org/sonar/javascript/checks/S6827.java | 5 +- .../org/sonar/javascript/checks/S6836.java | 5 +- .../org/sonar/javascript/checks/S6840.java | 5 +- .../org/sonar/javascript/checks/S6841.java | 5 +- .../org/sonar/javascript/checks/S6842.java | 5 +- .../org/sonar/javascript/checks/S6843.java | 5 +- .../org/sonar/javascript/checks/S6844.java | 5 +- .../org/sonar/javascript/checks/S6845.java | 5 +- .../org/sonar/javascript/checks/S6846.java | 5 +- .../org/sonar/javascript/checks/S6847.java | 11 +- .../org/sonar/javascript/checks/S6848.java | 5 +- .../org/sonar/javascript/checks/S6850.java | 5 +- .../org/sonar/javascript/checks/S6851.java | 5 +- .../org/sonar/javascript/checks/S6852.java | 5 +- .../org/sonar/javascript/checks/S6853.java | 5 +- .../org/sonar/javascript/checks/S6859.java | 5 +- .../org/sonar/javascript/checks/S6861.java | 5 +- .../org/sonar/javascript/checks/S6957.java | 5 +- .../org/sonar/javascript/checks/S6958.java | 5 +- .../org/sonar/javascript/checks/S6959.java | 5 +- .../org/sonar/javascript/checks/S7059.java | 3 +- .../org/sonar/javascript/checks/S7060.java | 4 +- .../org/sonar/javascript/checks/S878.java | 5 +- .../org/sonar/javascript/checks/S881.java | 5 +- .../org/sonar/javascript/checks/S888.java | 5 +- .../org/sonar/javascript/checks/S905.java | 2 - .../org/sonar/javascript/checks/S909.java | 5 +- .../org/sonar/javascript/checks/S930.java | 5 +- .../javascript/checks/CheckListTest.java | 3 +- .../org/sonar/javascript/checks/S106Test.java | 7 +- .../org/sonar/javascript/checks/S109Test.java | 7 +- .../sonar/javascript/checks/S1117Test.java | 3 +- .../org/sonar/javascript/checks/S117Test.java | 5 +- .../sonar/javascript/checks/S1186Test.java | 5 +- .../sonar/javascript/checks/S1192Test.java | 5 +- .../org/sonar/javascript/checks/S124Test.java | 26 +- .../sonar/javascript/checks/S1441Test.java | 10 +- .../sonar/javascript/checks/S1451Test.java | 7 +- .../sonar/javascript/checks/S2068Test.java | 4 +- .../sonar/javascript/checks/S2094Test.java | 7 +- .../sonar/javascript/checks/S2430Test.java | 5 +- .../sonar/javascript/checks/S2814Test.java | 5 +- .../sonar/javascript/checks/S3524Test.java | 15 +- .../sonar/javascript/checks/S4137Test.java | 8 +- .../sonar/javascript/checks/S4327Test.java | 5 +- .../sonar/javascript/checks/S4622Test.java | 3 +- .../sonar/javascript/checks/S5693Test.java | 8 +- .../sonar/javascript/checks/S6544Test.java | 7 +- .../sonar/javascript/checks/S6606Test.java | 7 +- .../sonar/javascript/checks/S6821Test.java | 5 +- .../sonar/javascript/checks/S6847Test.java | 4 +- .../org/sonar/javascript/checks/S905Test.java | 10 +- .../javascript/JavaScriptFilePredicate.java | 31 +- .../plugins/javascript/JavaScriptPlugin.java | 57 +- .../JavaScriptProfilesDefinition.java | 2 +- .../javascript/analysis/AbstractAnalysis.java | 29 +- .../analysis/AbstractBridgeSensor.java | 9 +- .../analysis/AnalysisConsumers.java | 2 +- .../analysis/AnalysisProcessor.java | 52 +- .../analysis/AnalysisWithProgram.java | 2 +- .../analysis/AnalysisWithWatchProgram.java | 7 +- .../javascript/analysis/CssRuleSensor.java | 20 +- .../javascript/analysis/JsTsChecks.java | 16 +- .../javascript/analysis/JsTsSensor.java | 13 +- .../analysis/LookupConfigProviderFilter.java | 24 +- .../javascript/analysis/QuickFixSupport.java | 43 +- .../javascript/analysis/TsConfigOrigin.java | 2 +- .../javascript/analysis/TsConfigProvider.java | 30 +- .../analysis/cache/CacheAnalysis.java | 5 +- .../cache/CacheAnalysisSerialization.java | 7 +- .../analysis/cache/CpdSerialization.java | 6 +- .../analysis/cache/SequenceSerialization.java | 3 +- .../analysis/cache/StringTable.java | 11 +- .../JavaScriptExclusionsFileFilter.java | 30 +- .../javascript/lcov/CoverageSensor.java | 21 +- .../plugins/javascript/lcov/LCOVParser.java | 21 +- .../rules/TslintRulesDefinition.java | 3 +- .../sonarlint/TsConfigCacheImpl.java | 38 +- .../plugins/javascript/utils/PathWalker.java | 3 +- .../JavaScriptFilePredicateTest.java | 42 +- .../javascript/JavaScriptLanguageTest.java | 9 +- .../javascript/JavaScriptPluginTest.java | 79 +- .../JavaScriptProfilesDefinitionTest.java | 47 +- .../analysis/AnalysisProcessorTest.java | 90 ++- .../analysis/CssRuleSensorTest.java | 61 +- .../javascript/analysis/HtmlSensorTest.java | 63 +- .../analysis/JavaScriptChecksTest.java | 5 +- .../JavaScriptEslintBasedSensorTest.java | 241 +++--- .../javascript/analysis/JsTsChecksTest.java | 24 +- .../javascript/analysis/JsTsSensorTest.java | 475 ++++++------ .../analysis/QuickFixSupportTest.java | 43 +- .../analysis/TsConfigCacheTest.java | 120 ++- .../javascript/analysis/TsConfigFileTest.java | 13 +- .../analysis/TsConfigProviderTest.java | 164 ++-- .../javascript/analysis/YamlSensorTest.java | 63 +- .../analysis/cache/CacheKeyTest.java | 5 +- .../analysis/cache/CacheReporterTest.java | 35 +- .../analysis/cache/CacheStrategyTest.java | 240 +++--- .../analysis/cache/CacheTestUtils.java | 38 +- .../analysis/cache/FileMetadataTest.java | 12 +- .../external/EslintReportSensorTest.java | 54 +- .../external/TslintReportSensorTest.java | 26 +- .../JavaScriptExclusionsFileFilterTest.java | 57 +- .../filter/MinificationAssessorTest.java | 5 +- .../javascript/lcov/CoverageSensorTest.java | 103 ++- .../javascript/lcov/FileLocatorTest.java | 15 +- .../rules/EslintRulesDefinitionTest.java | 16 +- .../rules/JavaScriptRulesDefinitionTest.java | 7 +- .../rules/TslintRulesDefinitionTest.java | 27 +- .../rules/TypeScriptRulesDefinitionTest.java | 13 +- .../javascript/utils/PathWalkerTest.java | 6 +- .../javascript/utils/ProgressReportTest.java | 15 +- .../utils/RulesMetadataForSonarLintTest.java | 190 +++-- .../standalone/StandaloneParser.java | 13 +- .../standalone/StandaloneParserTest.java | 20 +- .../StandaloneTemporaryFolderTest.java | 18 +- .../org/sonarsource/javascript/XZTest.java | 10 +- 606 files changed, 3997 insertions(+), 4461 deletions(-) diff --git a/its/perf/src/main/java/org/sonar/javascript/it/perf/SonarJsPerfBenchmark.java b/its/perf/src/main/java/org/sonar/javascript/it/perf/SonarJsPerfBenchmark.java index 1fc6e7446df..2e912fff370 100644 --- a/its/perf/src/main/java/org/sonar/javascript/it/perf/SonarJsPerfBenchmark.java +++ b/its/perf/src/main/java/org/sonar/javascript/it/perf/SonarJsPerfBenchmark.java @@ -155,7 +155,7 @@ private static void compare(Collection baseline, Collection MARGIN_PERCENT) { println("Performance degradation is greater than " + MARGIN_PERCENT + "%"); @@ -217,8 +217,7 @@ private static Optional getJsPluginVersion(Orchestrator orchestrator) { .execute() .getBodyAsString(); var plugins = new Gson().fromJson(installed, JsonObject.class).get("plugins").getAsJsonArray(); - return StreamSupport - .stream(plugins.spliterator(), false) + return StreamSupport.stream(plugins.spliterator(), false) .map(JsonElement::getAsJsonObject) .filter(e -> "javascript".equals(e.get("key").getAsString())) .map(e -> e.get("version").getAsString()) @@ -226,8 +225,7 @@ private static Optional getJsPluginVersion(Orchestrator orchestrator) { } private static Orchestrator orchestrator(Location pluginLocation) { - return OrchestratorExtension - .builderEnv() + return OrchestratorExtension.builderEnv() .setSonarVersion("LATEST_RELEASE") .setOrchestratorProperty("orchestrator.container.port", "9000") .useDefaultAdminCredentialsForBuilds(true) @@ -236,8 +234,7 @@ private static Orchestrator orchestrator(Location pluginLocation) { } private static BuildResult runScan(String token, String projectKey, int maxspace) { - var build = SonarScanner - .create(Path.of("../sources/jsts/projects/", projectKey).toFile()) + var build = SonarScanner.create(Path.of("../sources/jsts/projects/", projectKey).toFile()) .setProjectKey(projectKey) .setProjectName(projectKey) .setProjectVersion("1") diff --git a/its/plugin/plugins/consumer-plugin/src/main/java/org/sonar/samples/javascript/consumer/ConsumerPlugin.java b/its/plugin/plugins/consumer-plugin/src/main/java/org/sonar/samples/javascript/consumer/ConsumerPlugin.java index db9dae63dfd..a84a57de863 100644 --- a/its/plugin/plugins/consumer-plugin/src/main/java/org/sonar/samples/javascript/consumer/ConsumerPlugin.java +++ b/its/plugin/plugins/consumer-plugin/src/main/java/org/sonar/samples/javascript/consumer/ConsumerPlugin.java @@ -22,9 +22,6 @@ public class ConsumerPlugin implements Plugin { @Override public void define(Context context) { - context.addExtensions( - Consumer.class, - ConsumerSensor.class - ); + context.addExtensions(Consumer.class, ConsumerSensor.class); } } diff --git a/its/plugin/plugins/consumer-plugin/src/test/java/org/sonar/samples/javascript/consumer/ConsumerTest.java b/its/plugin/plugins/consumer-plugin/src/test/java/org/sonar/samples/javascript/consumer/ConsumerTest.java index 3bee72ab9b2..98782d5358f 100644 --- a/its/plugin/plugins/consumer-plugin/src/test/java/org/sonar/samples/javascript/consumer/ConsumerTest.java +++ b/its/plugin/plugins/consumer-plugin/src/test/java/org/sonar/samples/javascript/consumer/ConsumerTest.java @@ -24,9 +24,8 @@ class ConsumerTest { @Test void test() { - var consumer = new Consumer(); - consumer.doneAnalysis(); - assertTrue(consumer.isDone()); + var consumer = new Consumer(); + consumer.doneAnalysis(); + assertTrue(consumer.isDone()); } - } diff --git a/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/SonarLintTest.java b/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/SonarLintTest.java index e2c3a5b7d51..35c6846b23b 100644 --- a/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/SonarLintTest.java +++ b/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/SonarLintTest.java @@ -109,8 +109,7 @@ void should_raise_issues() throws IOException { .anyMatch(s -> s.matches("Using Node\\.js executable .* from property sonar\\.nodejs\\.executable\\.") ) - ) - .isTrue(); + ).isTrue(); } } @@ -179,10 +178,9 @@ void should_log_failure_only_once() throws IOException { // we need to stop engine initialized in @BeforeEach prepare() method, because we need configuration with different node sonarlintEngine.stop(); // version `42` will let us pass SonarLint check of version - sonarlintEngine = - new StandaloneSonarLintEngineImpl( - getSonarLintConfig(new File("invalid/path/node").toPath(), Version.create("42")) - ); + sonarlintEngine = new StandaloneSonarLintEngineImpl( + getSonarLintConfig(new File("invalid/path/node").toPath(), Version.create("42")) + ); List issues = analyze(FILE_PATH, ""); assertThat(logs).contains("Provided Node.js executable file does not exist."); assertThat(issues).isEmpty(); @@ -300,8 +298,7 @@ private StandaloneGlobalConfiguration getSonarLintConfig(Path nodePath, Version System.out.println(formattedMessage); }; - return StandaloneGlobalConfiguration - .builder() + return StandaloneGlobalConfiguration.builder() .addEnabledLanguage(Language.JS) .addEnabledLanguage(Language.TS) .addEnabledLanguage(Language.CSS) diff --git a/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/SonarLintTestCodeAnalysisTest.java b/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/SonarLintTestCodeAnalysisTest.java index c3f2625a4e4..002ccb5b330 100644 --- a/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/SonarLintTestCodeAnalysisTest.java +++ b/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/SonarLintTestCodeAnalysisTest.java @@ -46,8 +46,7 @@ void sonarlint() throws Exception { NodeJsHelper nodeJsHelper = new NodeJsHelper(); nodeJsHelper.detect(null); - StandaloneGlobalConfiguration globalConfig = StandaloneGlobalConfiguration - .builder() + StandaloneGlobalConfiguration globalConfig = StandaloneGlobalConfiguration.builder() .addEnabledLanguage(Language.JS) .addEnabledLanguage(Language.TS) .addPlugin(TestUtils.JAVASCRIPT_PLUGIN_LOCATION) @@ -65,8 +64,7 @@ void sonarlint() throws Exception { TestUtils.sonarLintInputFile(testFile, Files.readString(testFile)) ); - StandaloneAnalysisConfiguration analysisConfig = StandaloneAnalysisConfiguration - .builder() + StandaloneAnalysisConfiguration analysisConfig = StandaloneAnalysisConfiguration.builder() .setBaseDir(baseDir) .addInputFiles(inputFiles) .build(); diff --git a/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/TestUtils.java b/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/TestUtils.java index 6637432bfca..d93355519cb 100644 --- a/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/TestUtils.java +++ b/its/plugin/sonarlint-tests/src/test/java/com/sonar/javascript/it/plugin/sonarlint/tests/TestUtils.java @@ -33,7 +33,16 @@ public class TestUtils { static final Path JAVASCRIPT_PLUGIN_LOCATION = artifact(); - static final List platformStrings = List.of("darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64", "linux-x64-musl", "win-x64", "multi"); + static final List platformStrings = List.of( + "darwin-arm64", + "darwin-x64", + "linux-arm64", + "linux-x64", + "linux-x64-musl", + "win-x64", + "multi" + ); + /** * This is used to test artifact with and without embedded runtime during plugin QA integration tests * @@ -54,15 +63,18 @@ private static Path artifact() { private static Pattern pluginFilenameMatcher() { if (System.getenv("SONARJS_ARTIFACT") != null) { - return Pattern.compile(String.format("sonar-javascript-plugin-.*-%s\\.jar", System.getenv("SONARJS_ARTIFACT"))); + return Pattern.compile( + String.format("sonar-javascript-plugin-.*-%s\\.jar", System.getenv("SONARJS_ARTIFACT")) + ); } return Pattern.compile("sonar-javascript-plugin-[0-9.]*(?:-SNAPSHOT)?\\.jar"); } - static boolean usingEmbeddedNode() { - return platformStrings.stream().anyMatch(TestUtils.JAVASCRIPT_PLUGIN_LOCATION.toString()::contains); + return platformStrings + .stream() + .anyMatch(TestUtils.JAVASCRIPT_PLUGIN_LOCATION.toString()::contains); } public static Path projectDir(String projectName) { diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ConsumerPluginTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ConsumerPluginTest.java index 6531ddd4075..4b4c9ec3030 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ConsumerPluginTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ConsumerPluginTest.java @@ -16,6 +16,9 @@ */ package com.sonar.javascript.it.plugin; +import static com.sonar.javascript.it.plugin.OrchestratorStarter.JAVASCRIPT_PLUGIN_LOCATION; +import static org.assertj.core.api.Assertions.assertThat; + import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; import com.sonar.orchestrator.build.SonarScanner; @@ -26,9 +29,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import static com.sonar.javascript.it.plugin.OrchestratorStarter.JAVASCRIPT_PLUGIN_LOCATION; -import static org.assertj.core.api.Assertions.assertThat; - class ConsumerPluginTest { private static final String PLUGIN_ARTIFACT_ID = "consumer-plugin"; @@ -46,8 +46,7 @@ public static void after() { } static OrchestratorExtension initOrchestrator(String customRulesArtifactId) { - var orchestrator = OrchestratorExtension - .builderEnv() + var orchestrator = OrchestratorExtension.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) .addPlugin(JAVASCRIPT_PLUGIN_LOCATION) @@ -70,8 +69,7 @@ static OrchestratorExtension initOrchestrator(String customRulesArtifactId) { } static BuildResult runBuild(Orchestrator orchestrator) { - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDirNoCopy("custom_rules")) .setProjectKey("custom-rules") .setProjectName("Custom Rules") @@ -93,7 +91,8 @@ static BuildResult runBuild(Orchestrator orchestrator) { @Test void test() { var buildResult = runBuild(orchestrator); - var logMatch = ".*DEBUG: Registered JsAnalysisConsumers \\[org.sonar.samples.javascript.consumer.Consumer.*]"; + var logMatch = + ".*DEBUG: Registered JsAnalysisConsumers \\[org.sonar.samples.javascript.consumer.Consumer.*]"; assertThat(buildResult.getLogsLines(l -> l.matches(logMatch))).hasSize(1); // TS file is not processed yet. diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CoverageTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CoverageTest.java index 6b292bdd87e..87e1842cb0b 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CoverageTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CoverageTest.java @@ -34,8 +34,7 @@ class CoverageTest { @Test void LCOV_path_can_be_relative() { final String projectKey = "LcovPathCanBeRelative"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -55,8 +54,7 @@ void LCOV_path_can_be_relative() { @Test void LCOV_path_can_be_absolute() { final String projectKey = "LcovPathCanBeAbsolute"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -79,8 +77,7 @@ void LCOV_path_can_be_absolute() { @Test void LCOV_report_paths() { final String projectKey = "LcovReportPaths"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -103,8 +100,7 @@ void LCOV_report_paths() { @Test void LCOV_report_paths_alias() { final String projectKey = "LcovReportPathsAlias"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -124,8 +120,7 @@ void LCOV_report_paths_alias() { @Test void zero_coverage() { final String projectKey = "ZeroCoverage"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -147,8 +142,7 @@ void zero_coverage() { // SONARJS-301 public void print_log_for_not_found_resource() { final String projectKey = "PrintLogForNotFoundResource"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -177,8 +171,7 @@ public void print_log_for_not_found_resource() { // SONARJS-547 void wrong_line_in_report() { final String projectKey = "WrongLineInReport"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -211,8 +204,7 @@ void wrong_line_in_report() { @Test void conditions_on_non_executable_lines() { final String projectKey = "ConditionsOnNonExecutableLines"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov-jsx")) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -221,9 +213,9 @@ void conditions_on_non_executable_lines() { .setDebugLogs(true) .setProperty( "sonar.javascript.lcov.reportPaths", - TestUtils - .file("projects/lcov-jsx/conditions-on-non-executable-lines.lcov") - .getAbsolutePath() + TestUtils.file( + "projects/lcov-jsx/conditions-on-non-executable-lines.lcov" + ).getAbsolutePath() ); OrchestratorStarter.setEmptyProfile(projectKey); orchestrator.executeBuild(build); @@ -237,8 +229,7 @@ void conditions_on_non_executable_lines() { @Test void wildcard_LCOV_report_paths() { final String projectKey = "LcovWildcardReportPaths"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov-wildcard")) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -257,8 +248,7 @@ void wildcard_LCOV_report_paths() { @Test void LCOV_report_outside_module() { final String projectKey = "LcovReportOutsideModule"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("lcov")) .setProperty("sonar.modules", "dir") .setProjectKey(projectKey) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssMetricsTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssMetricsTest.java index cdec2d26db7..586d23d94a9 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssMetricsTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssMetricsTest.java @@ -41,44 +41,81 @@ public static void prepare() { void test() { assertThat(getMeasureAsDouble(PROJECT_KEY, "lines")).isEqualTo(89); assertThat(getMeasureAsDouble(PROJECT_KEY, "ncloc")).isEqualTo(52); - assertThat(getMeasure(PROJECT_KEY, "ncloc_language_distribution").getValue()) - .isEqualTo("css=27;php=1;web=24"); + assertThat(getMeasure(PROJECT_KEY, "ncloc_language_distribution").getValue()).isEqualTo( + "css=27;php=1;web=24" + ); assertThat(getMeasureAsDouble(PROJECT_KEY, "comment_lines")).isEqualTo(6); - assertThat(getMeasure(PROJECT_KEY + ":src/file1.css", "ncloc_data").getValue()) - .contains("1=1;", "2=1;", "3=1;", "4=1;", "5=1;", "6=1;", "7=1"); + assertThat(getMeasure(PROJECT_KEY + ":src/file1.css", "ncloc_data").getValue()).contains( + "1=1;", + "2=1;", + "3=1;", + "4=1;", + "5=1;", + "6=1;", + "7=1" + ); - assertThat(getMeasure(PROJECT_KEY + ":src/file2.less", "ncloc_data").getValue()) - .contains("1=1;", "2=1;", "3=1;", "4=1;", "5=1;", "6=1;", "7=1;", "8=1;", "9=1"); + assertThat(getMeasure(PROJECT_KEY + ":src/file2.less", "ncloc_data").getValue()).contains( + "1=1;", + "2=1;", + "3=1;", + "4=1;", + "5=1;", + "6=1;", + "7=1;", + "8=1;", + "9=1" + ); - assertThat(getMeasure(PROJECT_KEY + ":src/file3.scss", "ncloc_data").getValue()) - .contains("1=1;", "3=1;", "5=1;", "6=1;", "7=1;", "8=1"); + assertThat(getMeasure(PROJECT_KEY + ":src/file3.scss", "ncloc_data").getValue()).contains( + "1=1;", + "3=1;", + "5=1;", + "6=1;", + "7=1;", + "8=1" + ); - assertThat(getMeasure(PROJECT_KEY + ":src/file4.sass", "ncloc_data").getValue()) - .contains("1=1", "3=1", "5=1", "6=1", "7=1"); + assertThat(getMeasure(PROJECT_KEY + ":src/file4.sass", "ncloc_data").getValue()).contains( + "1=1", + "3=1", + "5=1", + "6=1", + "7=1" + ); - assertThat(getMeasure(PROJECT_KEY + ":src/file5.html", "ncloc_data").getValue()) - .contains("1=1", "2=1", "3=1", "4=1", "5=1", "6=1", "7=1", "8=1", "9=1", "10=1"); + assertThat(getMeasure(PROJECT_KEY + ":src/file5.html", "ncloc_data").getValue()).contains( + "1=1", + "2=1", + "3=1", + "4=1", + "5=1", + "6=1", + "7=1", + "8=1", + "9=1", + "10=1" + ); // .htm is not part of sonar-HTML languages. When it is, an assertion should be added for file6.htm // https://sonarsource.atlassian.net/jira/software/c/projects/SONARHTML/issues/SONARHTML-180 - assertThat(getMeasure(PROJECT_KEY + ":src/file7.xhtml", "ncloc_data").getValue()) - .contains( - "1=1", - "2=1", - "4=1", - "5=1", - "6=1", - "7=1", - "8=1", - "9=1", - "10=1", - "11=1", - "12=1", - "13=1", - "14=1", - "15=1" - ); + assertThat(getMeasure(PROJECT_KEY + ":src/file7.xhtml", "ncloc_data").getValue()).contains( + "1=1", + "2=1", + "4=1", + "5=1", + "6=1", + "7=1", + "8=1", + "9=1", + "10=1", + "11=1", + "12=1", + "13=1", + "14=1", + "15=1" + ); } } diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssStylelintReportTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssStylelintReportTest.java index ed796a02ec0..eee79c9be95 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssStylelintReportTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssStylelintReportTest.java @@ -38,9 +38,10 @@ class CssStylelintReportTest { @BeforeAll public static void prepare() { orchestrator.executeBuild( - CssTestsUtils - .createScanner(PROJECT_KEY) - .setProperty("sonar.css.stylelint.reportPaths", "report.json") + CssTestsUtils.createScanner(PROJECT_KEY).setProperty( + "sonar.css.stylelint.reportPaths", + "report.json" + ) ); } diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssTestsUtils.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssTestsUtils.java index 56656da5877..83eb00cf74e 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssTestsUtils.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/CssTestsUtils.java @@ -21,8 +21,7 @@ class CssTestsUtils { static SonarScanner createScanner(String projectKey) { - return OrchestratorStarter - .getSonarScanner() + return OrchestratorStarter.getSonarScanner() .setSourceEncoding("UTF-8") .setProjectDir(TestUtils.projectDir(projectKey)) .setProjectKey(projectKey) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EmbeddedNodeTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EmbeddedNodeTest.java index 5e8d5abbc73..0ae4553a562 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EmbeddedNodeTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EmbeddedNodeTest.java @@ -38,8 +38,7 @@ void embedded_node() { "sonar-javascript-plugin-*" + classifier() + ".jar" ); - var orchestrator = OrchestratorExtension - .builderEnv() + var orchestrator = OrchestratorExtension.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) .restoreProfileAtStartup(FileLocation.ofClasspath("/eslint-based-rules.xml")) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintBasedRulesTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintBasedRulesTest.java index 8ef21ee2eb0..b89225a1fc0 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintBasedRulesTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintBasedRulesTest.java @@ -52,14 +52,13 @@ class EslintBasedRulesTest { @BeforeAll static void setup() { - jsProfile = - generateProfile( - orchestrator, - "js", - "javascript", - new ProfileGenerator.RulesConfiguration(), - emptySet() - ); + jsProfile = generateProfile( + orchestrator, + "js", + "javascript", + new ProfileGenerator.RulesConfiguration(), + emptySet() + ); } @Test @@ -174,8 +173,9 @@ void should_not_use_node_in_cwd() throws Exception { Files.copy(ping, fakeNodePath, StandardCopyOption.REPLACE_EXISTING); BuildResult buildResult = orchestrator.executeBuild(build); assertThat(buildResult.isSuccess()).isTrue(); - assertThat(buildResult.getLogs()) - .contains("Looking for Node.js in the PATH using where.exe (Windows)"); + assertThat(buildResult.getLogs()).contains( + "Looking for Node.js in the PATH using where.exe (Windows)" + ); // compare that the node which we used is not "ping.exe" String log = buildResult.getLogsLines(s -> s.contains("Found node.exe at")).get(0); @@ -221,11 +221,10 @@ void jsFileNamedAsTsFile() { BuildResult buildResult = orchestrator.executeBuild(build); assertThat( - buildResult.getLogsLines(l -> - l.contains("Failed to parse") && l.contains("with TypeScript parser") + buildResult.getLogsLines( + l -> l.contains("Failed to parse") && l.contains("with TypeScript parser") ) - ) - .isEmpty(); + ).isEmpty(); var issuesList = getIssues(projectKey); assertThat(issuesList) @@ -253,10 +252,7 @@ void should_log_memory_config() { var buildResult = orchestrator.executeBuild(build); assertThat(buildResult.isSuccess()).isTrue(); assertThat(buildResult.getLogs()).contains("Configured Node.js --max-old-space-size=500000."); - var osMem = Pattern.compile( - ".*Memory configuration: OS \\(\\d+ MB\\),.*", - Pattern.DOTALL - ); + var osMem = Pattern.compile(".*Memory configuration: OS \\(\\d+ MB\\),.*", Pattern.DOTALL); assertThat(buildResult.getLogs()).matches(osMem); var warn = Pattern.compile( ".*WARN: Node.js heap size limit \\d+ is higher than available memory \\d+. Check your configuration of sonar\\.javascript\\.node\\.maxspace.*", diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintCustomRulesTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintCustomRulesTest.java index b68b67caea7..eea58ca96bc 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintCustomRulesTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintCustomRulesTest.java @@ -52,8 +52,7 @@ public static void after() { } static OrchestratorExtension initOrchestrator(String customRulesArtifactId) { - var orchestrator = OrchestratorExtension - .builderEnv() + var orchestrator = OrchestratorExtension.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) .addPlugin(JAVASCRIPT_PLUGIN_LOCATION) @@ -79,16 +78,14 @@ static List findIssues(String ruleKey, Orchestrator orchestrator) { org.sonarqube.ws.client.issues.SearchRequest searchRequest = new org.sonarqube.ws.client.issues.SearchRequest(); searchRequest.setRules(Collections.singletonList(ruleKey)); - Issues.SearchWsResponse response = OrchestratorStarter - .newWsClient(orchestrator) + Issues.SearchWsResponse response = OrchestratorStarter.newWsClient(orchestrator) .issues() .search(searchRequest); return response.getIssuesList(); } static BuildResult runBuild(Orchestrator orchestrator) { - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDirNoCopy("custom_rules")) .setProjectKey("custom-rules") .setProjectName("Custom Rules") @@ -114,18 +111,15 @@ void test() { ".*DEBUG: Deploying custom rules bundle jar:file:.*/custom-eslint-based-rules-1\\.0\\.0\\.tgz to .*" ) ) - ) - .hasSize(1); + ).hasSize(1); assertThat( buildResult.getLogsLines(l -> l.contains( "Custom JavaScript rules are deprecated and API will be removed in future version." ) ) - ) - .isEmpty(); - assertThat(buildResult.getLogsLines(l -> l.contains("Rule context options:"))) - .hasSize(2); + ).isEmpty(); + assertThat(buildResult.getLogsLines(l -> l.contains("Rule context options:"))).hasSize(2); List issues = findIssues("eslint-custom-rules:sqKey", orchestrator); assertThat(issues).hasSize(2); assertThat(issues) @@ -135,8 +129,9 @@ void test() { new Tuple("eslint-custom-rules:sqKey", "custom-rules:src/dir/file.ts", 4, "call") ); Common.Location secondaryLocation = issues.get(0).getFlows(0).getLocations(0); - assertThat(secondaryLocation.getMsg()) - .isEqualTo(new File(TestUtils.projectDirNoCopy("custom_rules"), ".scannerwork").getAbsolutePath()); + assertThat(secondaryLocation.getMsg()).isEqualTo( + new File(TestUtils.projectDirNoCopy("custom_rules"), ".scannerwork").getAbsolutePath() + ); issues = findIssues("ts-custom-rules:tsRuleKey", orchestrator); assertThat(issues) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintReportTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintReportTest.java index 029dca679b5..65423bf5fdf 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintReportTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/EslintReportTest.java @@ -44,8 +44,7 @@ class EslintReportTest { void should_save_issues_from_external_report_with_relative_paths() { String projectKey = PROJECT_KEY_PREFIX + "-relative"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(PROJECT_DIR) .setProjectKey(projectKey) .setProjectName(projectKey) @@ -62,8 +61,7 @@ void should_save_issues_from_external_report_with_relative_paths() { @Test void should_save_issues_from_external_report_with_absolute_paths() throws IOException { String projectKey = PROJECT_KEY_PREFIX + "-absolute"; - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(PROJECT_DIR) .setProjectKey(projectKey) .setProjectName(projectKey) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ExpectedIssues.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ExpectedIssues.java index fac7e3b98e3..50506d76e05 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ExpectedIssues.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ExpectedIssues.java @@ -44,8 +44,7 @@ public class ExpectedIssues { public static void parseForExpectedIssues(String projectKey, Path projectDir) throws IOException { Map expectedIssuesByRule = new HashMap<>(); - Arrays - .stream(projectDir.toFile().listFiles()) + Arrays.stream(projectDir.toFile().listFiles()) .filter(file -> file.toString().endsWith(".ts") || file.toString().endsWith(".tsx")) .forEach(file -> parseFile(projectKey, projectDir, expectedIssuesByRule, file.toPath())); diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ExternalTSConfigDependencyTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ExternalTSConfigDependencyTest.java index bebc4034d96..4f650b861e6 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ExternalTSConfigDependencyTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ExternalTSConfigDependencyTest.java @@ -61,8 +61,7 @@ void test() throws Exception { "WARN: At least one tsconfig.json was not found in the project. Please run 'npm install' for a more complete analysis. Check analysis logs for more details." ) ) - ) - .hasSize(1); + ).hasSize(1); File rootDrive = PROJECT_DIR; while (rootDrive.getParentFile() != null) { @@ -82,7 +81,6 @@ void test() throws Exception { "; falling back to an empty configuration." ) ) - ) - .hasSize(1); + ).hasSize(1); } } diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/HtmlSecurityTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/HtmlSecurityTest.java index d02873a40ea..0ec593f2fdf 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/HtmlSecurityTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/HtmlSecurityTest.java @@ -63,8 +63,7 @@ void should_not_generate_ucfgs_for_html() throws IOException { @BeforeAll public static void startOrchestrator() { - var builder = OrchestratorExtension - .builderEnv() + var builder = OrchestratorExtension.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) .addPlugin(JAVASCRIPT_PLUGIN_LOCATION) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/MetricsTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/MetricsTest.java index 32d01ba25ac..b729f6ae103 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/MetricsTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/MetricsTest.java @@ -36,8 +36,7 @@ class MetricsTest { @BeforeAll public static void prepare() { - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("metrics")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/MinifiedFilesTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/MinifiedFilesTest.java index 506b3430f70..774d19a79b4 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/MinifiedFilesTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/MinifiedFilesTest.java @@ -34,8 +34,7 @@ class MinifiedFilesTest { @BeforeAll public static void prepare() { - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("minified_files")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/OrchestratorStarter.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/OrchestratorStarter.java index a85280b180f..9e81d2dcd3b 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/OrchestratorStarter.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/OrchestratorStarter.java @@ -70,14 +70,15 @@ private static URLLocation artifact() { private static Pattern pluginFilenameMatcher() { if (System.getenv("SONARJS_ARTIFACT") != null) { - return Pattern.compile(String.format("sonar-javascript-plugin-.*-%s\\.jar", System.getenv("SONARJS_ARTIFACT"))); + return Pattern.compile( + String.format("sonar-javascript-plugin-.*-%s\\.jar", System.getenv("SONARJS_ARTIFACT")) + ); } return Pattern.compile("sonar-javascript-plugin-[0-9.]*(?:-SNAPSHOT)?\\.jar"); } - public static final OrchestratorExtension ORCHESTRATOR = OrchestratorExtension - .builderEnv() + public static final OrchestratorExtension ORCHESTRATOR = OrchestratorExtension.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) .addPlugin(MavenLocation.of("org.sonarsource.php", "sonar-php-plugin", "LATEST_RELEASE")) @@ -218,8 +219,7 @@ public static Double getMeasureAsDouble( } static WsClient newWsClient(Orchestrator orchestrator) { - return WsClientFactories - .getDefault() + return WsClientFactories.getDefault() .newClient(HttpConnector.newBuilder().url(orchestrator.getServer().getUrl()).build()); } diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/PRAnalysisTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/PRAnalysisTest.java index e1aeb4436f5..14b5cafb4f7 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/PRAnalysisTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/PRAnalysisTest.java @@ -76,8 +76,7 @@ void should_analyse_js_ts_pull_requests(String language) { gitExecutor.execute(git -> git.checkout().setName(Main.BRANCH)); var buildResult = scanWith(getMasterScannerIn(projectPath, projectKey)); - BuildResultAssert - .assertThat(buildResult) + BuildResultAssert.assertThat(buildResult) .withProjectKey(projectKey) .logsAtLeastOnce( "DEBUG: Analysis of unchanged files will not be skipped (current analysis requires all files to be analyzed)" @@ -103,8 +102,7 @@ void should_analyse_js_ts_pull_requests(String language) { .contains(projectKey + ":" + indexFile); gitExecutor.execute(git -> git.checkout().setName(PR.BRANCH)); - BuildResultAssert - .assertThat(scanWith(getBranchScannerIn(projectPath, projectKey))) + BuildResultAssert.assertThat(scanWith(getBranchScannerIn(projectPath, projectKey))) .withProjectKey(projectKey) .logsAtLeastOnce( "DEBUG: Files which didn't change will be part of UCFG generation only, other rules will not be executed" @@ -149,8 +147,7 @@ void should_analyse_yaml_pull_requests() { try (var gitExecutor = cloudformation.createIn(projectPath)) { gitExecutor.execute(git -> git.checkout().setName(Main.BRANCH)); - BuildResultAssert - .assertThat(scanWith(getMasterScannerIn(projectPath, projectKey))) + BuildResultAssert.assertThat(scanWith(getMasterScannerIn(projectPath, projectKey))) .withProjectKey(projectKey) .logsAtLeastOnce( "DEBUG: Analysis of unchanged files will not be skipped (current analysis requires all files to be analyzed)" @@ -176,8 +173,7 @@ void should_analyse_yaml_pull_requests() { assertThat(getIssues(orchestrator, projectKey, Main.BRANCH, null)).isEmpty(); gitExecutor.execute(git -> git.checkout().setName(PR.BRANCH)); - BuildResultAssert - .assertThat(scanWith(getBranchScannerIn(projectPath, projectKey))) + BuildResultAssert.assertThat(scanWith(getBranchScannerIn(projectPath, projectKey))) .withProjectKey(projectKey) .logsAtLeastOnce( "DEBUG: Files which didn't change will be part of UCFG generation only, other rules will not be executed" @@ -230,41 +226,37 @@ void should_generate_cpds(String name) { gitExecutor.execute(git -> git.checkout().setName(Main.BRANCH)); scanWith(getMasterScannerIn(projectPath, projectKey)); - MeasuresAssert - .assertThat(getMeasures(projectKey + ":file1." + language, Main.BRANCH, null)) + MeasuresAssert.assertThat(getMeasures(projectKey + ":file1." + language, Main.BRANCH, null)) .has("duplicated_lines", 30.0d) .has("duplicated_blocks", 1.0d) .has("duplicated_files", 1.0d) .has("duplicated_lines_density", 93.8d); - MeasuresAssert - .assertThat(getMeasures(projectKey + ":file2." + language, Main.BRANCH, null)) + MeasuresAssert.assertThat(getMeasures(projectKey + ":file2." + language, Main.BRANCH, null)) .has("duplicated_lines", 30.0d) .has("duplicated_blocks", 1.0d) .has("duplicated_files", 1.0d) .has("duplicated_lines_density", 88.2d); - MeasuresAssert - .assertThat(getMeasures(projectKey, Main.BRANCH, null)) + MeasuresAssert.assertThat(getMeasures(projectKey, Main.BRANCH, null)) .has("duplicated_lines", 60.0d) .has("duplicated_blocks", 2.0d) .has("duplicated_files", 2.0d) .has("duplicated_lines_density", 90.9d); gitExecutor.execute(git -> git.checkout().setName(PR.BRANCH)); - BuildResultAssert - .assertThat(scanWith(getBranchScannerIn(projectPath, projectKey))) - .logsTimes(2, "DEBUG: Processing cache analysis of file"); + BuildResultAssert.assertThat(scanWith(getBranchScannerIn(projectPath, projectKey))).logsTimes( + 2, + "DEBUG: Processing cache analysis of file" + ); - MeasuresAssert - .assertThat(getMeasures(projectKey + ":file3." + language, null, PR.BRANCH)) + MeasuresAssert.assertThat(getMeasures(projectKey + ":file3." + language, null, PR.BRANCH)) .has("duplicated_lines", 31.0d) .has("duplicated_blocks", 2.0d) .has("duplicated_files", 1.0d) .has("duplicated_lines_density", 96.9d); - MeasuresAssert - .assertThat(getMeasures(projectKey, null, PR.BRANCH)) + MeasuresAssert.assertThat(getMeasures(projectKey, null, PR.BRANCH)) .has("duplicated_lines", 92.0d) .has("duplicated_blocks", 5.0d) .has("duplicated_files", 3.0d) @@ -278,8 +270,7 @@ private static Measures getMeasures(String componentKey, String branch, String p @BeforeAll public static void startOrchestrator() { - var builder = OrchestratorExtension - .builderEnv() + var builder = OrchestratorExtension.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) .addPlugin(JAVASCRIPT_PLUGIN_LOCATION) @@ -403,12 +394,10 @@ static class GitExecutor implements AutoCloseable { GitExecutor(Path root) { try { - git = - Git - .init() - .setDirectory(Files.createDirectories(root).toFile()) - .setInitialBranch(Main.BRANCH) - .call(); + git = Git.init() + .setDirectory(Files.createDirectories(root).toFile()) + .setInitialBranch(Main.BRANCH) + .call(); } catch (IOException | GitAPIException e) { throw new RuntimeException(e); } diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ReferencedTSConfigTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ReferencedTSConfigTest.java index 1ef6f79deac..01484bd83cc 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ReferencedTSConfigTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/ReferencedTSConfigTest.java @@ -49,7 +49,8 @@ void test() throws Exception { BuildResult buildResult = orchestrator.executeBuild(build); - assertThat(buildResult.getLogsLines(l -> l.contains("INFO: TypeScript configuration file"))) - .hasSize(2); + assertThat( + buildResult.getLogsLines(l -> l.contains("INFO: TypeScript configuration file")) + ).hasSize(2); } } diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/SonarJsIntegrationTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/SonarJsIntegrationTest.java index 9a7dc805a70..1d0d054abc5 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/SonarJsIntegrationTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/SonarJsIntegrationTest.java @@ -184,8 +184,7 @@ void start(Path dest) throws IOException { } String request(String json, String endpoint) throws IOException, InterruptedException { - var request = HttpRequest - .newBuilder(url(endpoint)) + var request = HttpRequest.newBuilder(url(endpoint)) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TestCodeAnalysisTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TestCodeAnalysisTest.java index 75cd290ce4e..af8b967e84f 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TestCodeAnalysisTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TestCodeAnalysisTest.java @@ -69,7 +69,8 @@ void sonarqube() { List issuesList = newWsClient(orchestrator).issues().search(request).getIssuesList(); assertThat(issuesList).hasSize(1); assertThat(issuesList.get(0).getComponent()).endsWith("src/file.js"); - assertThat(buildResult.getLogsLines(l -> l.contains("2 source files to be analyzed"))) - .hasSize(1); + assertThat(buildResult.getLogsLines(l -> l.contains("2 source files to be analyzed"))).hasSize( + 1 + ); } } diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TestUtils.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TestUtils.java index 91f62b6238c..7247d9d2804 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TestUtils.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TestUtils.java @@ -41,12 +41,11 @@ public class TestUtils { throw new IllegalStateException("failed to obtain HOME", e); } - HOME = - testResources // home/tests/src/test/resources - .getParentFile() // home/tests/src/test - .getParentFile() // home/tests/src - .getParentFile() // home/tests - .getParentFile(); // home + HOME = testResources // home/tests/src/test/resources + .getParentFile() // home/tests/src/test + .getParentFile() // home/tests/src + .getParentFile() // home/tests + .getParentFile(); // home } public static File homeDir() { @@ -97,33 +96,30 @@ private static Path createTempDirForProject(String projectName) { static void deleteDirRecursively(Path pathToBeDeleted) { try (var walk = Files.walk(pathToBeDeleted)) { - walk - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); + walk.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete); } catch (IOException e) { throw new UncheckedIOException(e); } } - static void copyFolder(Path source, Path target, CopyOption... options) - throws IOException { - Files.walkFileTree(source, new SimpleFileVisitor<>() { - - @Override - public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) - throws IOException { - Files.createDirectories(target.resolve(source.relativize(dir).toString())); - return FileVisitResult.CONTINUE; - } - - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) - throws IOException { - Files.copy(file, target.resolve(source.relativize(file).toString()), options); - return FileVisitResult.CONTINUE; + static void copyFolder(Path source, Path target, CopyOption... options) throws IOException { + Files.walkFileTree( + source, + new SimpleFileVisitor<>() { + @Override + public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) + throws IOException { + Files.createDirectories(target.resolve(source.relativize(dir).toString())); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.copy(file, target.resolve(source.relativize(file).toString()), options); + return FileVisitResult.CONTINUE; + } } - }); + ); } public static File file(String relativePath) { diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TslintExternalReportTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TslintExternalReportTest.java index ff4cea8e04e..a9326e22972 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TslintExternalReportTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TslintExternalReportTest.java @@ -37,8 +37,7 @@ class TslintExternalReportTest { void should_save_issues_from_external_report() { OrchestratorStarter.setEmptyProfile(PROJECT_KEY); - SonarScanner build = OrchestratorStarter - .createScanner() + SonarScanner build = OrchestratorStarter.createScanner() .setProjectDir(TestUtils.projectDir("tslint-report-project")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeCheckerConfigTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeCheckerConfigTest.java index 42c86d68a44..de1e49f6520 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeCheckerConfigTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeCheckerConfigTest.java @@ -59,8 +59,7 @@ void multiple_targets() { var key = createName(project); var scanner = getSonarScanner(project); - BuildResultAssert - .assertThat(orchestrator.executeBuild(scanner)) + BuildResultAssert.assertThat(orchestrator.executeBuild(scanner)) .logsOnce("Found 1 tsconfig.json file(s)") .logsOnce( "INFO: Found 1 file(s) not part of any tsconfig.json: they will be analyzed without type information" @@ -75,8 +74,7 @@ void multiple_targets() { "sonar.typescript.tsconfigPaths", "tsconfig.json,tsconfig.es6.json" ); - BuildResultAssert - .assertThat(orchestrator.executeBuild(configuredBuild)) + BuildResultAssert.assertThat(orchestrator.executeBuild(configuredBuild)) .logsOnce("Found 2 TSConfig file(s)") .doesNotLog("INFO: Skipped"); @@ -99,9 +97,9 @@ void extend_main_from_folder() { var key = createName(project); var scanner = getSonarScanner(project); - BuildResultAssert - .assertThat(orchestrator.executeBuild(scanner)) - .logsOnce("Found 2 tsconfig.json file(s)"); + BuildResultAssert.assertThat(orchestrator.executeBuild(scanner)).logsOnce( + "Found 2 tsconfig.json file(s)" + ); assertThat(getIssues(key)).isEmpty(); // Missing issues for main.ts @@ -110,9 +108,9 @@ void extend_main_from_folder() { "sonar.typescript.tsconfigPaths", "src/tsconfig.json" ); - BuildResultAssert - .assertThat(orchestrator.executeBuild(configuredBuild)) - .logsOnce("Found 1 TSConfig file(s)"); + BuildResultAssert.assertThat(orchestrator.executeBuild(configuredBuild)).logsOnce( + "Found 1 TSConfig file(s)" + ); assertThat(getIssues(key)) .extracting(Issues.Issue::getLine, Issues.Issue::getComponent) @@ -138,9 +136,9 @@ void should_analyze_javascript_with_jsconfig() { "sonar.typescript.tsconfigPaths", "src/jsconfig.json" ); - BuildResultAssert - .assertThat(orchestrator.executeBuild(configuredBuild)) - .logsOnce("INFO: 2/2 source files have been analyzed"); + BuildResultAssert.assertThat(orchestrator.executeBuild(configuredBuild)).logsOnce( + "INFO: 2/2 source files have been analyzed" + ); assertThat(getIssues(key)).isEmpty(); // False negative } @@ -150,9 +148,9 @@ void should_analyze_with_zero_config(Project project) { var scanner = getSonarScanner(project.getName()); var buildResult = orchestrator.executeBuild(scanner); - BuildResultAssert - .assertThat(buildResult) - .logsOnce(String.format("Found %d tsconfig.json file(s)", project.getExpectedFound())); + BuildResultAssert.assertThat(buildResult).logsOnce( + String.format("Found %d tsconfig.json file(s)", project.getExpectedFound()) + ); assertThat(getIssues(project.getKey())) .extracting(Issues.Issue::getLine, Issues.Issue::getComponent) .containsExactlyInAnyOrder(project.getIssues()); @@ -170,8 +168,7 @@ private static SonarScanner getSonarScanner(String directory) { orchestrator.getServer().associateProjectToQualityProfile(key, "ts", createName("ts-profile")); orchestrator.getServer().associateProjectToQualityProfile(key, "js", createName("js-profile")); - return OrchestratorStarter - .getSonarScanner() + return OrchestratorStarter.getSonarScanner() .setProjectKey(key) .setSourceEncoding("UTF-8") .setSourceDirs(".") @@ -236,8 +233,7 @@ int getExpectedFound() { } Tuple[] getIssues() { - return Arrays - .stream(filesWithIssue) + return Arrays.stream(filesWithIssue) .map(file -> tuple(ISSUE_LINE, getKey() + ":" + file)) .toArray(Tuple[]::new); } diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeScriptAnalysisTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeScriptAnalysisTest.java index 6d6f21439b9..90a9dfde121 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeScriptAnalysisTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeScriptAnalysisTest.java @@ -64,21 +64,26 @@ void test() throws Exception { assertThat(OrchestratorStarter.getMeasureAsInt(sampleFileKey, "statements")).isEqualTo(3); assertThat(OrchestratorStarter.getMeasureAsInt(sampleFileKey, "comment_lines")).isEqualTo(1); assertThat(OrchestratorStarter.getMeasureAsInt(sampleFileKey, "complexity")).isEqualTo(2); - assertThat(OrchestratorStarter.getMeasureAsInt(sampleFileKey, "cognitive_complexity")) - .isEqualTo(2); + assertThat( + OrchestratorStarter.getMeasureAsInt(sampleFileKey, "cognitive_complexity") + ).isEqualTo(2); - assertThat(OrchestratorStarter.getMeasureAsDouble(projectKey, "duplicated_lines")) - .isEqualTo(111.0); - assertThat(OrchestratorStarter.getMeasureAsDouble(projectKey, "duplicated_blocks")) - .isEqualTo(2.0); - assertThat(OrchestratorStarter.getMeasureAsDouble(projectKey, "duplicated_files")) - .isEqualTo(1.0); + assertThat(OrchestratorStarter.getMeasureAsDouble(projectKey, "duplicated_lines")).isEqualTo( + 111.0 + ); + assertThat(OrchestratorStarter.getMeasureAsDouble(projectKey, "duplicated_blocks")).isEqualTo( + 2.0 + ); + assertThat(OrchestratorStarter.getMeasureAsDouble(projectKey, "duplicated_files")).isEqualTo( + 1.0 + ); issuesList = getIssues(projectKey + ":nosonar.lint.ts"); assertThat(issuesList).hasSize(1); - assertThat(result.getLogsLines(log -> log.contains("Found 1 tsconfig.json file(s)"))) - .hasSize(1); + assertThat(result.getLogsLines(log -> log.contains("Found 1 tsconfig.json file(s)"))).hasSize( + 1 + ); } @Test @@ -112,10 +117,10 @@ void should_use_custom_tsconfig() throws Exception { "Resolving TSConfig files using 'custom.tsconfig.json' from property sonar.typescript.tsconfigPath" ) ) - ) - .hasSize(1); - assertThat(result.getLogsLines(l -> l.contains("Found 1 TSConfig file(s): [" + tsconfig + "]"))) - .hasSize(1); + ).hasSize(1); + assertThat( + result.getLogsLines(l -> l.contains("Found 1 TSConfig file(s): [" + tsconfig + "]")) + ).hasSize(1); } @Test @@ -145,8 +150,9 @@ void should_use_multiple_custom_tsconfigs() throws Exception { projectDir.getCanonicalFile().toPath().resolve(Paths.get("dir", "custom.tsconfig.json")), projectDir.getCanonicalFile().toPath().resolve("tsconfig.json") ); - assertThat(result.getLogsLines(l -> l.contains("Found 2 TSConfig file(s): " + tsconfigs))) - .hasSize(1); + assertThat( + result.getLogsLines(l -> l.contains("Found 2 TSConfig file(s): " + tsconfigs)) + ).hasSize(1); } @Test @@ -166,8 +172,9 @@ void should_analyze_without_tsconfig() throws Exception { List issuesList = getIssues(projectKey); assertThat(issuesList).extracting(Issue::getRule).containsExactly("typescript:S4325"); - assertThat(result.getLogsLines(l -> l.contains("Using generated tsconfig.json file"))) - .hasSize(1); + assertThat(result.getLogsLines(l -> l.contains("Using generated tsconfig.json file"))).hasSize( + 1 + ); } /** @@ -197,8 +204,9 @@ void should_analyze_without_tsconfig_vue() throws Exception { tuple(6, "typescript:S3923", "missing-tsconfig-vue:src/file.vue") ); - assertThat(result.getLogsLines(l -> l.contains("Using generated tsconfig.json file"))) - .hasSize(1); + assertThat(result.getLogsLines(l -> l.contains("Using generated tsconfig.json file"))).hasSize( + 1 + ); } @Test @@ -230,14 +238,12 @@ void should_exclude_from_extended_tsconfig() throws Exception { "INFO: Found 1 file(s) not part of any tsconfig.json: they will be analyzed without type information" ) ) - ) - .hasSize(1); + ).hasSize(1); assertThat( result.getLogsLines(l -> l.contains("File not part of any tsconfig.json: dir/file.excluded.ts") ) - ) - .hasSize(1); + ).hasSize(1); } @Test @@ -263,11 +269,10 @@ void should_support_solution_tsconfig() { ); assertThat( - result.getLogsLines(l -> - l.contains("Skipped") && l.contains("because they were not part of any tsconfig.json") + result.getLogsLines( + l -> l.contains("Skipped") && l.contains("because they were not part of any tsconfig.json") ) - ) - .isEmpty(); + ).isEmpty(); } @Test @@ -295,11 +300,10 @@ void should_support_solution_tsconfig_with_dir_reference() { ); assertThat( - result.getLogsLines(l -> - l.contains("Skipped") && l.contains("because they were not part of any tsconfig.json") + result.getLogsLines( + l -> l.contains("Skipped") && l.contains("because they were not part of any tsconfig.json") ) - ) - .isEmpty(); + ).isEmpty(); } @Test diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeScriptRuleTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeScriptRuleTest.java index 097f1ffe1bd..8034dd3967e 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeScriptRuleTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/TypeScriptRuleTest.java @@ -45,16 +45,14 @@ class TypeScriptRuleTest { @BeforeAll public static void before() throws IOException, InterruptedException { - orchestrator = - OrchestratorExtension - .builderEnv() - .useDefaultAdminCredentialsForBuilds(true) - .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) - .addPlugin(JAVASCRIPT_PLUGIN_LOCATION) - .addPlugin( - MavenLocation.of("org.sonarsource.sonar-lits-plugin", "sonar-lits-plugin", LITS_VERSION) - ) - .build(); + orchestrator = OrchestratorExtension.builderEnv() + .useDefaultAdminCredentialsForBuilds(true) + .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) + .addPlugin(JAVASCRIPT_PLUGIN_LOCATION) + .addPlugin( + MavenLocation.of("org.sonarsource.sonar-lits-plugin", "sonar-lits-plugin", LITS_VERSION) + ) + .build(); // Installation of SQ server in orchestrator is not thread-safe, so we need to synchronize synchronized (OrchestratorStarter.class) { @@ -128,7 +126,6 @@ void test() throws Exception { assertThat( new String(Files.readAllBytes(Paths.get("target/differences")), StandardCharsets.UTF_8) - ) - .isEmpty(); + ).isEmpty(); } } diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/VueAnalysisTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/VueAnalysisTest.java index 53a43532913..6b5e0d19e13 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/VueAnalysisTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/VueAnalysisTest.java @@ -54,8 +54,9 @@ void sonarqube() { assertThat(OrchestratorStarter.getMeasureAsInt(projectKey, "statements")).isEqualTo(3); assertThat(OrchestratorStarter.getMeasureAsInt(projectKey, "comment_lines")).isEqualTo(0); assertThat(OrchestratorStarter.getMeasureAsInt(projectKey, "complexity")).isEqualTo(1); - assertThat(OrchestratorStarter.getMeasureAsInt(projectKey, "cognitive_complexity")) - .isEqualTo(2); + assertThat(OrchestratorStarter.getMeasureAsInt(projectKey, "cognitive_complexity")).isEqualTo( + 2 + ); } @Test @@ -95,8 +96,9 @@ void tsWithinVueAsTypeScript() { assertThat(OrchestratorStarter.getMeasureAsInt(vueFileKey, "statements")).isEqualTo(3); assertThat(OrchestratorStarter.getMeasureAsInt(vueFileKey, "comment_lines")).isEqualTo(0); assertThat(OrchestratorStarter.getMeasureAsInt(vueFileKey, "complexity")).isEqualTo(1); - assertThat(OrchestratorStarter.getMeasureAsInt(vueFileKey, "cognitive_complexity")) - .isEqualTo(2); + assertThat(OrchestratorStarter.getMeasureAsInt(vueFileKey, "cognitive_complexity")).isEqualTo( + 2 + ); // assert both .vue and .ts files are analyzed diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/YamlSecurityTest.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/YamlSecurityTest.java index 4e2e2fbe53d..6fa3d1783f5 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/YamlSecurityTest.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/YamlSecurityTest.java @@ -65,8 +65,7 @@ void should_generate_ucfgs_for_yaml() throws IOException { @BeforeAll public static void startOrchestrator() { - var builder = OrchestratorExtension - .builderEnv() + var builder = OrchestratorExtension.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) .addPlugin(JAVASCRIPT_PLUGIN_LOCATION) diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/assertj/BuildResultAssert.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/assertj/BuildResultAssert.java index 7d1290d7dea..f30b31faaf2 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/assertj/BuildResultAssert.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/assertj/BuildResultAssert.java @@ -59,8 +59,7 @@ private static Matcher logMatcher( return new CustomMatcher<>(description) { @Override public boolean matches(Object item) { - return Optional - .ofNullable(item) + return Optional.ofNullable(item) .filter(BuildResult.class::isInstance) .map(BuildResult.class::cast) .map(result -> result.getLogsLines(logPredicate).size()) @@ -105,10 +104,8 @@ public BuildResultAssert doesNotLog(String log) { public BuildResultAssert logsTimes(int times, String... logs) { for (var log : logs) { - logsTimesWhere( - format("has log \"%s\" %d time(s)", log, times), - times, - line -> line.contains(log) + logsTimesWhere(format("has log \"%s\" %d time(s)", log, times), times, line -> + line.contains(log) ); } return this; @@ -153,9 +150,11 @@ public BuildResultAssert generatesUcfgFilesForAll(Path projectPath, String... fi // We check if sis_ts_index_ts ends with index_ts var key = ucfgFile.getFileName().toString().replaceFirst("(_\\d+)?[.][^.]+$", ""); // We remove index and extension: _1.ucfgs - Assertions - .assertThat(filenames) - .filteredOn(filename -> filename.replace('.', '_').endsWith(key) || key.endsWith(filename.replace('.', '_'))) + Assertions.assertThat(filenames) + .filteredOn( + filename -> + filename.replace('.', '_').endsWith(key) || key.endsWith(filename.replace('.', '_')) + ) .isNotEmpty(); } } catch (IOException e) { @@ -191,8 +190,7 @@ public FileCacheStrategy withReason(String reason) { } public BuildResultAssert isUsed() { - IntStream - .range(0, files.size()) + IntStream.range(0, files.size()) .mapToObj(i -> tuple(files.get(i), cachedFilesCounts.get(i))) .forEach(this::check); return BuildResultAssert.this; diff --git a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/assertj/MeasuresAssert.java b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/assertj/MeasuresAssert.java index f8e9df0cbdd..143914c39f4 100644 --- a/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/assertj/MeasuresAssert.java +++ b/its/plugin/tests/src/test/java/com/sonar/javascript/it/plugin/assertj/MeasuresAssert.java @@ -44,8 +44,7 @@ public static MeasuresAssert assertThat(Measures measures) { } public MeasuresAssert has(String metricKey, double value) { - Assertions - .assertThat(measures.get(metricKey)) + Assertions.assertThat(measures.get(metricKey)) .as("measure %s", metricKey, value) .isEqualTo(value, offset); return this; diff --git a/its/ruling/src/test/java/org/sonar/javascript/it/CssRulingTest.java b/its/ruling/src/test/java/org/sonar/javascript/it/CssRulingTest.java index 187af6e0704..ba3b576599a 100644 --- a/its/ruling/src/test/java/org/sonar/javascript/it/CssRulingTest.java +++ b/its/ruling/src/test/java/org/sonar/javascript/it/CssRulingTest.java @@ -40,8 +40,7 @@ class CssRulingTest { private static final String PROJECT_KEY = "project"; @RegisterExtension - public static final OrchestratorExtension ORCHESTRATOR = OrchestratorExtension - .builderEnv() + public static final OrchestratorExtension ORCHESTRATOR = OrchestratorExtension.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty(SQ_VERSION_PROPERTY, DEFAULT_SQ_VERSION)) .addPlugin(MavenLocation.of("org.sonarsource.php", "sonar-php-plugin", "LATEST_RELEASE")) @@ -104,8 +103,7 @@ void test() throws Exception { ORCHESTRATOR.getServer().associateProjectToQualityProfile(PROJECT_KEY, "js", "rules"); ORCHESTRATOR.getServer().associateProjectToQualityProfile(PROJECT_KEY, "ts", "rules"); File litsDifferencesFile = FileLocation.of("target/differences").getFile(); - SonarScanner build = SonarScanner - .create(FileLocation.of("../sources/css").getFile()) + SonarScanner build = SonarScanner.create(FileLocation.of("../sources/css").getFile()) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY) .setProjectVersion("1") diff --git a/its/ruling/src/test/java/org/sonar/javascript/it/JsTsRulingTest.java b/its/ruling/src/test/java/org/sonar/javascript/it/JsTsRulingTest.java index 944604cc533..7d89078a2a9 100644 --- a/its/ruling/src/test/java/org/sonar/javascript/it/JsTsRulingTest.java +++ b/its/ruling/src/test/java/org/sonar/javascript/it/JsTsRulingTest.java @@ -65,8 +65,7 @@ class JsTsRulingTest { static final String DEFAULT_EXCLUSIONS = "**/.*,**/*.d.ts"; @RegisterExtension - public static final OrchestratorExtension orchestrator = OrchestratorExtension - .builderEnv() + public static final OrchestratorExtension orchestrator = OrchestratorExtension.builderEnv() .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) .addPlugin( @@ -279,8 +278,7 @@ static void runRulingTest(String projectKey, String sources, String exclusions, } var differencesPath = Path.of("target", projectKey + "-differences").toAbsolutePath(); - SonarScanner build = SonarScanner - .create(sourcesLocation) + SonarScanner build = SonarScanner.create(sourcesLocation) .setProjectKey(projectKey) .setProjectName(projectKey) .setProjectVersion("1") @@ -328,16 +326,14 @@ private static void instantiateTemplateRule( .setPreventReactivation("true") .setParams( Arrays.asList( - ( - "name=\"" + - instantiationKey + - "\";key=\"" + - instantiationKey + - "\";markdown_description=\"" + - instantiationKey + - "\";" + - params - ).split(";", 0) + ("name=\"" + + instantiationKey + + "\";key=\"" + + instantiationKey + + "\";markdown_description=\"" + + instantiationKey + + "\";" + + params).split(";", 0) ) ) ); @@ -368,21 +364,19 @@ private static void instantiateTemplateRule( } else { throw new IllegalStateException( "Could not retrieve profile key : Template rule " + - ruleTemplateKey + - " has not been activated" + ruleTemplateKey + + " has not been activated" ); } } static WsClient newAdminWsClient(Orchestrator orchestrator) { - return WsClientFactories - .getDefault() + return WsClientFactories.getDefault() .newClient( - HttpConnector - .newBuilder() + HttpConnector.newBuilder() .credentials(Server.ADMIN_LOGIN, Server.ADMIN_PASSWORD) .url(orchestrator.getServer().getUrl()) .build() ); } -} \ No newline at end of file +} diff --git a/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/Check.java b/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/Check.java index 72e927be8a2..fb868d3c778 100644 --- a/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/Check.java +++ b/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/Check.java @@ -19,6 +19,7 @@ import org.sonar.check.Rule; public class Check implements EslintBasedCheck { + /** * This should be named `key()`, but we keep the compatibility with the legacy semantic. */ diff --git a/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/JsAnalysisConsumer.java b/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/JsAnalysisConsumer.java index 2c06dc04209..be61e5cd310 100644 --- a/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/JsAnalysisConsumer.java +++ b/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/JsAnalysisConsumer.java @@ -26,7 +26,6 @@ @ScannerSide @SonarLintSide public interface JsAnalysisConsumer { - /** * Called for each file during the analysis. * @param jsFile the file which was analyzed diff --git a/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/JsFile.java b/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/JsFile.java index 6c96ef8b737..8479501c461 100644 --- a/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/JsFile.java +++ b/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/JsFile.java @@ -19,5 +19,4 @@ import org.sonar.api.batch.fs.InputFile; import org.sonar.plugins.javascript.api.estree.ESTree; -public record JsFile(InputFile inputFile, ESTree.Program program) { -} +public record JsFile(InputFile inputFile, ESTree.Program program) {} diff --git a/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/estree/ESTree.java b/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/estree/ESTree.java index e1d61484ab3..374278c36e9 100644 --- a/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/estree/ESTree.java +++ b/sonar-plugin/api/src/main/java/org/sonar/plugins/javascript/api/estree/ESTree.java @@ -32,139 +32,451 @@ public class ESTree { private ESTree() { // shouldn't be instantiated, used only as a namespace } - - public sealed interface Node { + + public sealed interface Node { Location loc(); } - + public record Position(int line, int column) {} + public record Location(Position start, Position end) {} - + public sealed interface CallExpression extends Expression { ExpressionOrSuper callee(); List arguments(); } + public sealed interface ChainElement extends Node { boolean optional(); } - public sealed interface Declaration extends Statement { - } - public sealed interface Expression extends ExpressionOrSpreadElement, ExpressionOrSuper, ExpressionOrPrivateIdentifier, ExpressionOrPattern, ExpressionOrVariableDeclaration, ExpressionOrClassDeclarationOrFunctionDeclaration, BlockStatementOrExpression { + public sealed interface Declaration extends Statement {} + + public sealed interface Expression + extends + ExpressionOrSpreadElement, + ExpressionOrSuper, + ExpressionOrPrivateIdentifier, + ExpressionOrPattern, + ExpressionOrVariableDeclaration, + ExpressionOrClassDeclarationOrFunctionDeclaration, + BlockStatementOrExpression {} - } public sealed interface Literal extends Expression, IdentifierOrLiteral { String raw(); } - public sealed interface ModuleDeclaration extends DirectiveOrModuleDeclarationOrStatement { - } - public sealed interface Pattern extends ExpressionOrPattern, PatternOrVariableDeclaration, MemberExpressionOrPattern { + public sealed interface ModuleDeclaration extends DirectiveOrModuleDeclarationOrStatement {} - } - public sealed interface Statement extends DirectiveOrModuleDeclarationOrStatement { + public sealed interface Pattern + extends ExpressionOrPattern, PatternOrVariableDeclaration, MemberExpressionOrPattern {} - } + public sealed interface Statement extends DirectiveOrModuleDeclarationOrStatement {} public sealed interface ExpressionOrSpreadElement extends Node {} + public sealed interface BlockStatementOrExpression extends Node {} + public sealed interface MemberExpressionOrPattern extends Node {} + public sealed interface ExpressionOrPrivateIdentifier extends Node {} + public sealed interface MethodDefinitionOrPropertyDefinitionOrStaticBlock extends Node {} + public sealed interface ExpressionOrClassDeclarationOrFunctionDeclaration extends Node {} + public sealed interface PatternOrVariableDeclaration extends Node {} + public sealed interface ExpressionOrVariableDeclaration extends Node {} - public sealed interface ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier extends Node {} + + public sealed interface ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier + extends Node {} + public sealed interface ExpressionOrSuper extends Node {} + public sealed interface PropertyOrSpreadElement extends Node {} + public sealed interface PropertyOrRestElement extends Node {} + public sealed interface DirectiveOrModuleDeclarationOrStatement extends Node {} + public sealed interface ExpressionOrPattern extends Node {} + public sealed interface IdentifierOrLiteral extends Node {} - - public record ArrayExpression(Location loc, List> elements) implements Expression {} + + public record ArrayExpression(Location loc, List> elements) + implements Expression {} + public record ArrayPattern(Location loc, List> elements) implements Pattern {} - public record ArrowFunctionExpression(Location loc, boolean expression, BlockStatementOrExpression body, List params, boolean generator, boolean async) implements Expression {} - public record AssignmentExpression(Location loc, AssignmentOperator operator, MemberExpressionOrPattern left, Expression right) implements Expression {} - public record AssignmentPattern(Location loc, Pattern left, Expression right) implements Pattern {} + + public record ArrowFunctionExpression( + Location loc, + boolean expression, + BlockStatementOrExpression body, + List params, + boolean generator, + boolean async + ) + implements Expression {} + + public record AssignmentExpression( + Location loc, + AssignmentOperator operator, + MemberExpressionOrPattern left, + Expression right + ) + implements Expression {} + + public record AssignmentPattern(Location loc, Pattern left, Expression right) + implements Pattern {} + public record AwaitExpression(Location loc, Expression argument) implements Expression {} - public record BigIntLiteral(Location loc, BigInteger value, String bigint, String raw) implements Literal {} - public record BinaryExpression(Location loc, BinaryOperator operator, Expression left, Expression right) implements Expression {} - public record BlockStatement(Location loc, List body) implements BlockStatementOrExpression, Statement {} + + public record BigIntLiteral(Location loc, BigInteger value, String bigint, String raw) + implements Literal {} + + public record BinaryExpression( + Location loc, + BinaryOperator operator, + Expression left, + Expression right + ) + implements Expression {} + + public record BlockStatement(Location loc, List body) + implements BlockStatementOrExpression, Statement {} + public record BreakStatement(Location loc, Optional label) implements Statement {} - public record CatchClause(Location loc, Optional param, BlockStatement body) implements Node {} + + public record CatchClause(Location loc, Optional param, BlockStatement body) + implements Node {} + public record ChainExpression(Location loc, ChainElement expression) implements Expression {} - public record ClassBody(Location loc, List body) implements Node {} + + public record ClassBody( + Location loc, + List body + ) + implements Node {} + // See "ExportDefaultDeclaration" for explanation about the optional id field. - public record ClassDeclaration(Location loc, Optional id, Optional superClass, ClassBody body) implements Declaration, ExpressionOrClassDeclarationOrFunctionDeclaration {} - public record ClassExpression(Location loc, Optional id, Optional superClass, ClassBody body) implements Expression {} - public record ConditionalExpression(Location loc, Expression test, Expression alternate, Expression consequent) implements Expression {} + public record ClassDeclaration( + Location loc, + Optional id, + Optional superClass, + ClassBody body + ) + implements Declaration, ExpressionOrClassDeclarationOrFunctionDeclaration {} + + public record ClassExpression( + Location loc, + Optional id, + Optional superClass, + ClassBody body + ) + implements Expression {} + + public record ConditionalExpression( + Location loc, + Expression test, + Expression alternate, + Expression consequent + ) + implements Expression {} + public record ContinueStatement(Location loc, Optional label) implements Statement {} + public record DebuggerStatement(Location loc) implements Statement {} - public record Directive(Location loc, Literal expression, String directive) implements Statement {} - public record DoWhileStatement(Location loc, Statement body, Expression test) implements Statement {} + + public record Directive(Location loc, Literal expression, String directive) + implements Statement {} + + public record DoWhileStatement(Location loc, Statement body, Expression test) + implements Statement {} + public record EmptyStatement(Location loc) implements Statement {} - public record ExportAllDeclaration(Location loc, Optional exported, Literal source) implements ModuleDeclaration {} + + public record ExportAllDeclaration( + Location loc, + Optional exported, + Literal source + ) + implements ModuleDeclaration {} + public record ExportAssignment(Location loc, Expression expression) implements Statement {} + // In "d.ts" file, the declaration field has type: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression. // The "MaybeNamed" are there to show that the id is optional in this specific case. // We decided to not create this extra class, and instead use the existing FunctionDeclaration and ClassDeclaration classes. // The consequence is that the id field of these classes is now optional (while it is not in the "d.ts" file). - public record ExportDefaultDeclaration(Location loc, ExpressionOrClassDeclarationOrFunctionDeclaration declaration) implements ModuleDeclaration {} - public record ExportNamedDeclaration(Location loc, Optional declaration, List specifiers, Optional source) implements ModuleDeclaration {} - public record ExportSpecifier(Location loc, Identifier exported, Identifier local) implements Node {} + public record ExportDefaultDeclaration( + Location loc, + ExpressionOrClassDeclarationOrFunctionDeclaration declaration + ) + implements ModuleDeclaration {} + + public record ExportNamedDeclaration( + Location loc, + Optional declaration, + List specifiers, + Optional source + ) + implements ModuleDeclaration {} + + public record ExportSpecifier(Location loc, Identifier exported, Identifier local) + implements Node {} + public record ExpressionStatement(Location loc, Expression expression) implements Statement {} - public record ForInStatement(Location loc, PatternOrVariableDeclaration left, Expression right, Statement body) implements Statement {} - public record ForOfStatement(Location loc, boolean await, PatternOrVariableDeclaration left, Expression right, Statement body) implements Statement {} - public record ForStatement(Location loc, Optional init, Optional test, Optional update, Statement body) implements Statement {} + + public record ForInStatement( + Location loc, + PatternOrVariableDeclaration left, + Expression right, + Statement body + ) + implements Statement {} + + public record ForOfStatement( + Location loc, + boolean await, + PatternOrVariableDeclaration left, + Expression right, + Statement body + ) + implements Statement {} + + public record ForStatement( + Location loc, + Optional init, + Optional test, + Optional update, + Statement body + ) + implements Statement {} + // See "ExportDefaultDeclaration" for explanation about the optional id field. - public record FunctionDeclaration(Location loc, Optional id, BlockStatement body, List params, boolean generator, boolean async) implements Declaration, ExpressionOrClassDeclarationOrFunctionDeclaration {} - public record FunctionExpression(Location loc, Optional id, BlockStatement body, List params, boolean generator, boolean async) implements Expression {} - public record Identifier(Location loc, String name) implements Expression, Pattern, IdentifierOrLiteral {} - public record IfStatement(Location loc, Expression test, Statement consequent, Optional alternate) implements Statement {} - public record ImportDeclaration(Location loc, List specifiers, Literal source) implements ModuleDeclaration {} - public record ImportDefaultSpecifier(Location loc, Identifier local) implements ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier {} + public record FunctionDeclaration( + Location loc, + Optional id, + BlockStatement body, + List params, + boolean generator, + boolean async + ) + implements Declaration, ExpressionOrClassDeclarationOrFunctionDeclaration {} + + public record FunctionExpression( + Location loc, + Optional id, + BlockStatement body, + List params, + boolean generator, + boolean async + ) + implements Expression {} + + public record Identifier(Location loc, String name) + implements Expression, Pattern, IdentifierOrLiteral {} + + public record IfStatement( + Location loc, + Expression test, + Statement consequent, + Optional alternate + ) + implements Statement {} + + public record ImportDeclaration( + Location loc, + List specifiers, + Literal source + ) + implements ModuleDeclaration {} + + public record ImportDefaultSpecifier(Location loc, Identifier local) + implements ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier {} + public record ImportExpression(Location loc, Expression source) implements Expression {} - public record ImportNamespaceSpecifier(Location loc, Identifier local) implements ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier {} - public record ImportSpecifier(Location loc, Identifier imported, Identifier local) implements ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier {} - public record LabeledStatement(Location loc, Identifier label, Statement body) implements Statement {} - public record LogicalExpression(Location loc, LogicalOperator operator, Expression left, Expression right) implements Expression {} - public record MemberExpression(Location loc, ExpressionOrSuper object, ExpressionOrPrivateIdentifier property, boolean computed, boolean optional) implements ChainElement, Expression, Pattern {} - public record MetaProperty(Location loc, Identifier meta, Identifier property) implements Expression {} - public record MethodDefinition(Location loc, ExpressionOrPrivateIdentifier key, FunctionExpression value, String kind, boolean computed, boolean isStatic) implements MethodDefinitionOrPropertyDefinitionOrStaticBlock {} - public record NewExpression(Location loc, ExpressionOrSuper callee, List arguments) implements CallExpression {} - public record ObjectExpression(Location loc, List properties) implements Expression {} - public record ObjectPattern(Location loc, List properties) implements Pattern {} - public record PrivateIdentifier(Location loc, String name) implements ExpressionOrPrivateIdentifier {} - public record Program(Location loc, String sourceType, List body) implements Node {} + + public record ImportNamespaceSpecifier(Location loc, Identifier local) + implements ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier {} + + public record ImportSpecifier(Location loc, Identifier imported, Identifier local) + implements ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier {} + + public record LabeledStatement(Location loc, Identifier label, Statement body) + implements Statement {} + + public record LogicalExpression( + Location loc, + LogicalOperator operator, + Expression left, + Expression right + ) + implements Expression {} + + public record MemberExpression( + Location loc, + ExpressionOrSuper object, + ExpressionOrPrivateIdentifier property, + boolean computed, + boolean optional + ) + implements ChainElement, Expression, Pattern {} + + public record MetaProperty(Location loc, Identifier meta, Identifier property) + implements Expression {} + + public record MethodDefinition( + Location loc, + ExpressionOrPrivateIdentifier key, + FunctionExpression value, + String kind, + boolean computed, + boolean isStatic + ) + implements MethodDefinitionOrPropertyDefinitionOrStaticBlock {} + + public record NewExpression( + Location loc, + ExpressionOrSuper callee, + List arguments + ) + implements CallExpression {} + + public record ObjectExpression(Location loc, List properties) + implements Expression {} + + public record ObjectPattern(Location loc, List properties) + implements Pattern {} + + public record PrivateIdentifier(Location loc, String name) + implements ExpressionOrPrivateIdentifier {} + + public record Program( + Location loc, + String sourceType, + List body + ) + implements Node {} + // In Estree "d.ts", we also have an "AssignmentProperty", which is a "Property" with a "kind" field set to "init". // We decided to not create this extra class, and instead use the existing Property class, as it is not trivial to distinguish between the two. - public record Property(Location loc, ExpressionOrPrivateIdentifier key, ExpressionOrPattern value, String kind, boolean method, boolean shorthand, boolean computed) implements PropertyOrSpreadElement, PropertyOrRestElement {} - public record PropertyDefinition(Location loc, ExpressionOrPrivateIdentifier key, Optional value, boolean computed, boolean isStatic) implements MethodDefinitionOrPropertyDefinitionOrStaticBlock {} - public record RegExpLiteral(Location loc, String pattern, String flags, String raw) implements Literal {} - public record RestElement(Location loc, Pattern argument) implements PropertyOrRestElement, Pattern {} + public record Property( + Location loc, + ExpressionOrPrivateIdentifier key, + ExpressionOrPattern value, + String kind, + boolean method, + boolean shorthand, + boolean computed + ) + implements PropertyOrSpreadElement, PropertyOrRestElement {} + + public record PropertyDefinition( + Location loc, + ExpressionOrPrivateIdentifier key, + Optional value, + boolean computed, + boolean isStatic + ) + implements MethodDefinitionOrPropertyDefinitionOrStaticBlock {} + + public record RegExpLiteral(Location loc, String pattern, String flags, String raw) + implements Literal {} + + public record RestElement(Location loc, Pattern argument) + implements PropertyOrRestElement, Pattern {} + public record ReturnStatement(Location loc, Optional argument) implements Statement {} - public record SequenceExpression(Location loc, List expressions) implements Expression {} - public record SimpleCallExpression(Location loc, boolean optional, ExpressionOrSuper callee, List arguments) implements CallExpression, ChainElement {} + + public record SequenceExpression(Location loc, List expressions) + implements Expression {} + + public record SimpleCallExpression( + Location loc, + boolean optional, + ExpressionOrSuper callee, + List arguments + ) + implements CallExpression, ChainElement {} + public record SimpleLiteral(Location loc, Object value, String raw) implements Literal {} - public record SpreadElement(Location loc, Expression argument) implements ExpressionOrSpreadElement, PropertyOrSpreadElement {} - public record StaticBlock(Location loc, List body) implements MethodDefinitionOrPropertyDefinitionOrStaticBlock, Statement {} + + public record SpreadElement(Location loc, Expression argument) + implements ExpressionOrSpreadElement, PropertyOrSpreadElement {} + + public record StaticBlock(Location loc, List body) + implements MethodDefinitionOrPropertyDefinitionOrStaticBlock, Statement {} + public record Super(Location loc) implements ExpressionOrSuper {} - public record SwitchCase(Location loc, Optional test, List consequent) implements Node {} - public record SwitchStatement(Location loc, Expression discriminant, List cases) implements Statement {} - public record TaggedTemplateExpression(Location loc, Expression tag, TemplateLiteral quasi) implements Expression {} - public record TemplateElement(Location loc, boolean tail, String cooked, String raw) implements Node {} - public record TemplateLiteral(Location loc, List quasis, List expressions) implements Expression {} + + public record SwitchCase(Location loc, Optional test, List consequent) + implements Node {} + + public record SwitchStatement(Location loc, Expression discriminant, List cases) + implements Statement {} + + public record TaggedTemplateExpression(Location loc, Expression tag, TemplateLiteral quasi) + implements Expression {} + + public record TemplateElement(Location loc, boolean tail, String cooked, String raw) + implements Node {} + + public record TemplateLiteral( + Location loc, + List quasis, + List expressions + ) + implements Expression {} + public record ThisExpression(Location loc) implements Expression {} + public record ThrowStatement(Location loc, Expression argument) implements Statement {} - public record TryStatement(Location loc, BlockStatement block, Optional handler, Optional finalizer) implements Statement {} - public record UnaryExpression(Location loc, UnaryOperator operator, boolean prefix, Expression argument) implements Expression {} - public record UpdateExpression(Location loc, UpdateOperator operator, Expression argument, boolean prefix) implements Expression {} - public record VariableDeclaration(Location loc, List declarations, String kind) implements ExpressionOrVariableDeclaration, PatternOrVariableDeclaration, Declaration {} - public record VariableDeclarator(Location loc, Pattern id, Optional init) implements Node {} - public record WhileStatement(Location loc, Expression test, Statement body) implements Statement {} - public record WithStatement(Location loc, Expression object, Statement body) implements Statement {} - public record YieldExpression(Location loc, Optional argument, boolean delegate) implements Expression {} + + public record TryStatement( + Location loc, + BlockStatement block, + Optional handler, + Optional finalizer + ) + implements Statement {} + + public record UnaryExpression( + Location loc, + UnaryOperator operator, + boolean prefix, + Expression argument + ) + implements Expression {} + + public record UpdateExpression( + Location loc, + UpdateOperator operator, + Expression argument, + boolean prefix + ) + implements Expression {} + + public record VariableDeclaration( + Location loc, + List declarations, + String kind + ) + implements ExpressionOrVariableDeclaration, PatternOrVariableDeclaration, Declaration {} + + public record VariableDeclarator(Location loc, Pattern id, Optional init) + implements Node {} + + public record WhileStatement(Location loc, Expression test, Statement body) + implements Statement {} + + public record WithStatement(Location loc, Expression object, Statement body) + implements Statement {} + + public record YieldExpression(Location loc, Optional argument, boolean delegate) + implements Expression {} + public record UnknownNode(Location loc, String rawType) implements Expression {} public interface Operator { @@ -172,7 +484,13 @@ public interface Operator { } public enum UnaryOperator implements Operator { - MINUS("-"), PLUS("+"), LOGICAL_NOT("!"), BITWISE_NOT("~"), TYPEOF("typeof"), VOID("void"), DELETE("delete"); + MINUS("-"), + PLUS("+"), + LOGICAL_NOT("!"), + BITWISE_NOT("~"), + TYPEOF("typeof"), + VOID("void"), + DELETE("delete"); private final String raw; @@ -186,32 +504,35 @@ public String raw() { } public static UnaryOperator from(String operator) { - return Arrays.stream(values()).filter(v -> Objects.equals(operator, v.raw)).findFirst().orElse(null); + return Arrays.stream(values()) + .filter(v -> Objects.equals(operator, v.raw)) + .findFirst() + .orElse(null); } } - + public enum BinaryOperator implements Operator { - EQUAL("=="), - NOT_EQUAL("!="), - STRICT_EQUAL("==="), - STRICT_NOT_EQUAL("!=="), - LESS_THAN("<"), - LESS_THAN_OR_EQUAL("<="), - GREATER_THAN(">"), - GREATER_THAN_OR_EQUAL(">="), - LEFT_SHIFT("<<"), - RIGHT_SHIFT(">>"), - UNSIGNED_RIGHT_SHIFT(">>>"), - PLUS("+"), - MINUS("-"), - MULTIPLY("*"), - DIVIDE("/"), - MODULO("%"), - EXPONENTIATION("**"), - BITWISE_AND("&"), - BITWISE_OR("|"), - BITWISE_XOR("^"), - IN("in"), + EQUAL("=="), + NOT_EQUAL("!="), + STRICT_EQUAL("==="), + STRICT_NOT_EQUAL("!=="), + LESS_THAN("<"), + LESS_THAN_OR_EQUAL("<="), + GREATER_THAN(">"), + GREATER_THAN_OR_EQUAL(">="), + LEFT_SHIFT("<<"), + RIGHT_SHIFT(">>"), + UNSIGNED_RIGHT_SHIFT(">>>"), + PLUS("+"), + MINUS("-"), + MULTIPLY("*"), + DIVIDE("/"), + MODULO("%"), + EXPONENTIATION("**"), + BITWISE_AND("&"), + BITWISE_OR("|"), + BITWISE_XOR("^"), + IN("in"), INSTANCEOF("instanceof"); private final String raw; @@ -226,12 +547,17 @@ public String raw() { } public static BinaryOperator from(String operator) { - return Arrays.stream(values()).filter(v -> Objects.equals(operator, v.raw)).findFirst().orElse(null); + return Arrays.stream(values()) + .filter(v -> Objects.equals(operator, v.raw)) + .findFirst() + .orElse(null); } } - + public enum LogicalOperator implements Operator { - AND("&&"), OR("||"), NULLISH_COALESCING("??"); + AND("&&"), + OR("||"), + NULLISH_COALESCING("??"); private final String raw; @@ -245,16 +571,19 @@ public String raw() { } public static LogicalOperator from(String operator) { - return Arrays.stream(values()).filter(v -> Objects.equals(operator, v.raw)).findFirst().orElse(null); + return Arrays.stream(values()) + .filter(v -> Objects.equals(operator, v.raw)) + .findFirst() + .orElse(null); } } - + public enum AssignmentOperator implements Operator { - ASSIGN("="), - PLUS_ASSIGN("+="), - MINUS_ASSIGN("-="), - MULTIPLY_ASSIGN("*="), - DIVIDE_ASSIGN("/="), + ASSIGN("="), + PLUS_ASSIGN("+="), + MINUS_ASSIGN("-="), + MULTIPLY_ASSIGN("*="), + DIVIDE_ASSIGN("/="), MODULO_ASSIGN("%="), EXPONENTIATION_ASSIGN("**="), LEFT_SHIFT_ASSIGN("<<="), @@ -265,8 +594,7 @@ public enum AssignmentOperator implements Operator { BITWISE_AND_ASSIGN("&="), LOGICAL_OR_ASSIGN("||="), LOGICAL_AND_ASSIGN("&&="), - NULLISH_COALESCING_ASSIGN("??=") - ; + NULLISH_COALESCING_ASSIGN("??="); private final String raw; @@ -280,12 +608,16 @@ public String raw() { } public static AssignmentOperator from(String operator) { - return Arrays.stream(values()).filter(v -> Objects.equals(operator, v.raw)).findFirst().orElse(null); + return Arrays.stream(values()) + .filter(v -> Objects.equals(operator, v.raw)) + .findFirst() + .orElse(null); } } - + public enum UpdateOperator implements Operator { - INCREMENT("++"), DECREMENT("--"); + INCREMENT("++"), + DECREMENT("--"); private final String raw; @@ -299,8 +631,10 @@ public String raw() { } public static UpdateOperator from(String operator) { - return Arrays.stream(values()).filter(v -> Objects.equals(operator, v.raw)).findFirst().orElse(null); + return Arrays.stream(values()) + .filter(v -> Objects.equals(operator, v.raw)) + .findFirst() + .orElse(null); } } } - diff --git a/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/CustomRuleRepositoryTest.java b/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/CustomRuleRepositoryTest.java index 221da30750b..f26d3950bfe 100644 --- a/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/CustomRuleRepositoryTest.java +++ b/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/CustomRuleRepositoryTest.java @@ -44,7 +44,6 @@ public List> checkClasses() { } } - @Rule(key="key") - static class CustomCheck extends Check { - } + @Rule(key = "key") + static class CustomCheck extends Check {} } diff --git a/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/EslintBasedCheckTest.java b/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/EslintBasedCheckTest.java index 6727abb7ad9..7e263cc4364 100644 --- a/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/EslintBasedCheckTest.java +++ b/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/EslintBasedCheckTest.java @@ -24,9 +24,8 @@ class EslintBasedCheckTest { - @Rule(key="key") - static class CustomCheck extends Check { - } + @Rule(key = "key") + static class CustomCheck extends Check {} @Test void test() { diff --git a/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/estree/ESTreeTest.java b/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/estree/ESTreeTest.java index 37d919d4517..6f364955219 100644 --- a/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/estree/ESTreeTest.java +++ b/sonar-plugin/api/src/test/java/org/sonar/plugins/javascript/api/estree/ESTreeTest.java @@ -25,7 +25,6 @@ class ESTreeTest { @Test void test() { - Class[] classes = ESTree.class.getDeclaredClasses(); assertThat(classes).hasSize(108); diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/AnalysisMode.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/AnalysisMode.java index fe047fa436d..b5ebb7d69c2 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/AnalysisMode.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/AnalysisMode.java @@ -35,7 +35,6 @@ public enum AnalysisMode { public static final String UNCHANGED_LINTER_ID = "unchanged"; private static final Logger LOG = LoggerFactory.getLogger(AnalysisMode.class); - public static AnalysisMode getMode(SensorContext context) { var logDefaultMode = "Analysis of unchanged files will not be skipped ({})"; @@ -61,7 +60,9 @@ public static AnalysisMode getMode(SensorContext context) { } private static boolean hasSecurityRules(ActiveRules activeRules) { - return Stream.of("jssecurity", "tssecurity").anyMatch(r -> !activeRules.findByRepository(r).isEmpty()); + return Stream.of("jssecurity", "tssecurity").anyMatch(r -> + !activeRules.findByRepository(r).isEmpty() + ); } public static List getUnchangedFileRules(List rules) { diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServer.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServer.java index f6ec0a9e1aa..ac030ab1779 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServer.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServer.java @@ -16,6 +16,8 @@ */ package org.sonar.plugins.javascript.bridge; +import static org.sonarsource.api.sonarlint.SonarLintSide.INSTANCE; + import java.io.IOException; import java.util.List; import javax.annotation.Nullable; @@ -26,15 +28,19 @@ import org.sonar.plugins.javascript.bridge.protobuf.Node; import org.sonarsource.api.sonarlint.SonarLintSide; -import static org.sonarsource.api.sonarlint.SonarLintSide.INSTANCE; - @ScannerSide @SonarLintSide(lifespan = INSTANCE) public interface BridgeServer extends Startable { void startServerLazily(BridgeServerConfig context) throws IOException; - void initLinter(List rules, List environments, List globals, AnalysisMode analysisMode, String baseDir, - List exclusions) throws IOException; + void initLinter( + List rules, + List environments, + List globals, + AnalysisMode analysisMode, + String baseDir, + List exclusions + ) throws IOException; AnalysisResponse analyzeJavaScript(JsAnalysisRequest request) throws IOException; @@ -62,34 +68,68 @@ void initLinter(List rules, List environments, List TsConfigFile createTsConfigFile(String content) throws IOException; - record JsAnalysisRequest(String filePath, String fileType, String language, @Nullable String fileContent, boolean ignoreHeaderComments, - @Nullable List tsConfigs, @Nullable String programId, String linterId, boolean skipAst, boolean shouldClearDependenciesCache) { - - } - - record CssAnalysisRequest(String filePath, @Nullable String fileContent, List rules) { - } + record JsAnalysisRequest( + String filePath, + String fileType, + String language, + @Nullable String fileContent, + boolean ignoreHeaderComments, + @Nullable List tsConfigs, + @Nullable String programId, + String linterId, + boolean skipAst, + boolean shouldClearDependenciesCache + ) {} + + record CssAnalysisRequest( + String filePath, + @Nullable String fileContent, + List rules + ) {} record BridgeResponse(String json, @Nullable Node ast) { public BridgeResponse(String json) { this(json, null); } } - record AnalysisResponse(@Nullable ParsingError parsingError, List issues, List highlights, - List highlightedSymbols, Metrics metrics, List cpdTokens, List ucfgPaths, @Nullable Node ast) { + record AnalysisResponse( + @Nullable ParsingError parsingError, + List issues, + List highlights, + List highlightedSymbols, + Metrics metrics, + List cpdTokens, + List ucfgPaths, + @Nullable Node ast + ) { public AnalysisResponse(AnalysisResponse response, @Nullable Node ast) { - this(response.parsingError, response.issues, response.highlights, response.highlightedSymbols, - response.metrics, response.cpdTokens, response.ucfgPaths, ast); + this( + response.parsingError, + response.issues, + response.highlights, + response.highlightedSymbols, + response.metrics, + response.cpdTokens, + response.ucfgPaths, + ast + ); } public AnalysisResponse() { this(null, List.of(), List.of(), List.of(), new Metrics(), List.of(), List.of(), null); } - public AnalysisResponse(@Nullable ParsingError parsingError, @Nullable List issues, @Nullable List highlights, - @Nullable List highlightedSymbols, @Nullable Metrics metrics, - @Nullable List cpdTokens, List ucfgPaths, @Nullable Node ast) { + public AnalysisResponse( + @Nullable ParsingError parsingError, + @Nullable List issues, + @Nullable List highlights, + @Nullable List highlightedSymbols, + @Nullable Metrics metrics, + @Nullable List cpdTokens, + List ucfgPaths, + @Nullable Node ast + ) { this.parsingError = parsingError; this.issues = issues != null ? issues : List.of(); this.highlights = highlights != null ? highlights : List.of(); @@ -101,42 +141,43 @@ public AnalysisResponse(@Nullable ParsingError parsingError, @Nullable List secondaryLocations, Double cost, List quickFixes) { - } + record Issue( + Integer line, + Integer column, + Integer endLine, + Integer endColumn, + String message, + String ruleId, + List secondaryLocations, + Double cost, + List quickFixes + ) {} - record QuickFix(String message, List edits) { - } + record QuickFix(String message, List edits) {} - record QuickFixEdit(String text, IssueLocation loc) { - } + record QuickFixEdit(String text, IssueLocation loc) {} record IssueLocation( + Integer line, + Integer column, + Integer endLine, + Integer endColumn, + String message + ) {} - Integer line, Integer column, Integer endLine, Integer endColumn, String message) { - } + record Highlight(Location location, String textType) {} - record Highlight( - - Location location, String textType) { - } - - record HighlightedSymbol( - - Location declaration, List references) { - } - - record Location( - - int startLine, int startCol, int endLine, int endCol) { + record HighlightedSymbol(Location declaration, List references) {} + record Location(int startLine, int startCol, int endLine, int endCol) { public TextRange toTextRange(InputFile inputFile) { return inputFile.newRange(this.startLine, this.startCol, this.endLine, this.endCol); } @@ -148,18 +189,22 @@ public String toString() { } record Metrics( - - List ncloc, List commentLines, List nosonarLines, List executableLines, int functions, - int statements, int classes, int complexity, int cognitiveComplexity) { + List ncloc, + List commentLines, + List nosonarLines, + List executableLines, + int functions, + int statements, + int classes, + int complexity, + int cognitiveComplexity + ) { public Metrics() { this(List.of(), List.of(), List.of(), List.of(), 0, 0, 0, 0, 0); } } - record CpdToken( - - Location location, String image) { - } + record CpdToken(Location location, String image) {} class TsConfigResponse { @@ -168,7 +213,12 @@ class TsConfigResponse { final String error; final ParsingErrorCode errorCode; - TsConfigResponse(List files, List projectReferences, @Nullable String error, @Nullable ParsingErrorCode errorCode) { + TsConfigResponse( + List files, + List projectReferences, + @Nullable String error, + @Nullable ParsingErrorCode errorCode + ) { this.files = files; this.projectReferences = projectReferences; this.error = error; @@ -177,14 +227,26 @@ class TsConfigResponse { } record TsProgram( - @Nullable String programId, @Nullable List files, @Nullable List projectReferences, boolean missingTsConfig, - @Nullable String error) { - - public TsProgram(String programId, @Nullable List files, @Nullable List projectReferences) { + @Nullable String programId, + @Nullable List files, + @Nullable List projectReferences, + boolean missingTsConfig, + @Nullable String error + ) { + public TsProgram( + String programId, + @Nullable List files, + @Nullable List projectReferences + ) { this(programId, files, projectReferences, false, null); } - public TsProgram(String programId, List files, List projectReferences, boolean missingTsConfig) { + public TsProgram( + String programId, + List files, + List projectReferences, + boolean missingTsConfig + ) { this(programId, files, projectReferences, missingTsConfig, null); } @@ -195,13 +257,22 @@ public TsProgram(String error) { @Override public String toString() { if (error == null) { - return ("TsProgram{" + "programId='" + programId + '\'' + ", files=" + files + ", projectReferences=" + projectReferences + '}'); + return ( + "TsProgram{" + + "programId='" + + programId + + '\'' + + ", files=" + + files + + ", projectReferences=" + + projectReferences + + '}' + ); } else { return "TsProgram{ error='" + error + "'}"; } } } - record TsProgramRequest(String tsConfig) { - } + record TsProgramRequest(String tsConfig) {} } diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServerConfig.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServerConfig.java index 934d303043d..d6893ce8a7e 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServerConfig.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServerConfig.java @@ -26,9 +26,16 @@ * This class will contain only information required by {@link BridgeServerImpl}. * This will reduce the dependency on external API, and ease the testing. */ -public record BridgeServerConfig(Configuration config, String workDirAbsolutePath, SonarProduct product) { - +public record BridgeServerConfig( + Configuration config, + String workDirAbsolutePath, + SonarProduct product +) { public static BridgeServerConfig fromSensorContext(SensorContext context) { - return new BridgeServerConfig(context.config(), context.fileSystem().workDir().getAbsolutePath(), context.runtime().getProduct()); + return new BridgeServerConfig( + context.config(), + context.fileSystem().workDir().getAbsolutePath(), + context.runtime().getProduct() + ); } } diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServerImpl.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServerImpl.java index 2b342d992d6..89feb631f1e 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServerImpl.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/BridgeServerImpl.java @@ -162,13 +162,12 @@ void serverHasStarted() { status = Status.STARTED; if (heartbeatFuture == null) { LOG.trace("Starting heartbeat service"); - heartbeatFuture = - heartbeatService.scheduleAtFixedRate( - this::heartbeat, - HEARTBEAT_INTERVAL_SECONDS, - HEARTBEAT_INTERVAL_SECONDS, - TimeUnit.SECONDS - ); + heartbeatFuture = heartbeatService.scheduleAtFixedRate( + this::heartbeat, + HEARTBEAT_INTERVAL_SECONDS, + HEARTBEAT_INTERVAL_SECONDS, + TimeUnit.SECONDS + ); } } @@ -188,9 +187,11 @@ void deploy(Configuration configuration) throws IOException { } else { bundle.deploy(temporaryDeployLocation); } - if (configuration.get(NODE_EXECUTABLE_PROPERTY).isPresent() || - configuration.getBoolean(SKIP_NODE_PROVISIONING_PROPERTY).orElse(false) || - configuration.getBoolean(NODE_FORCE_HOST_PROPERTY).orElse(false)) { + if ( + configuration.get(NODE_EXECUTABLE_PROPERTY).isPresent() || + configuration.getBoolean(SKIP_NODE_PROVISIONING_PROPERTY).orElse(false) || + configuration.getBoolean(NODE_FORCE_HOST_PROPERTY).orElse(false) + ) { String property; if (configuration.get(NODE_EXECUTABLE_PROPERTY).isPresent()) { property = NODE_EXECUTABLE_PROPERTY; @@ -255,8 +256,11 @@ boolean waitServerToStart(int timeoutMs) { return true; } - private NodeCommand initNodeCommand(BridgeServerConfig serverConfig, File scriptFile, String bundles) - throws IOException { + private NodeCommand initNodeCommand( + BridgeServerConfig serverConfig, + File scriptFile, + String bundles + ) throws IOException { var workdir = serverConfig.workDirAbsolutePath(); var config = serverConfig.config(); var allowTsParserJsFiles = config.getBoolean(ALLOW_TS_PARSER_JS_FILES).orElse(true); @@ -471,7 +475,10 @@ TsConfigResponse tsConfigFiles(String tsconfigAbsolutePath) { return GSON.fromJson(result, TsConfigResponse.class); } catch (JsonSyntaxException e) { LOG.error( - "Failed to parse response when requesting files for tsconfig: {}: \n-----\n{}\n-----\n{}", tsconfigAbsolutePath, result, e.getMessage() + "Failed to parse response when requesting files for tsconfig: {}: \n-----\n{}\n-----\n{}", + tsconfigAbsolutePath, + result, + e.getMessage() ); } return new TsConfigResponse(emptyList(), emptyList(), result, null); @@ -563,8 +570,7 @@ private URI url(String endpoint) { int nodeAlreadyRunningPort() { try { - int existingNodePort = Optional - .ofNullable(getExistingNodeProcessPort()) + int existingNodePort = Optional.ofNullable(getExistingNodeProcessPort()) .map(Integer::parseInt) .orElse(0); if (existingNodePort < 0 || existingNodePort > 65535) { diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/ESTreeFactory.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/ESTreeFactory.java index f90777d2bd6..3006be93a3c 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/ESTreeFactory.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/ESTreeFactory.java @@ -100,89 +100,91 @@ private ESTreeFactory() { } public static T from(Node node, Class clazz) { - ESTree.Node estreeNode = switch (node.getType()) { - case ProgramType -> fromProgramType(node); - case ExportAllDeclarationType -> fromExportAllDeclarationType(node); - case IdentifierType -> fromIdentifierType(node); - case ExportDefaultDeclarationType -> fromExportDefaultDeclarationType(node); - case YieldExpressionType -> fromYieldExpressionType(node); - case UpdateExpressionType -> fromUpdateExpressionType(node); - case UnaryExpressionType -> fromUnaryExpressionType(node); - case ThisExpressionType -> fromThisExpressionType(node); - case TemplateLiteralType -> fromTemplateLiteralType(node); - case TaggedTemplateExpressionType -> fromTaggedTemplateExpressionType(node); - case SequenceExpressionType -> fromSequenceExpressionType(node); - case ObjectExpressionType -> fromObjectExpressionType(node); - case SpreadElementType -> fromSpreadElementType(node); - case PropertyType -> fromPropertyType(node); - case AssignmentPatternType -> fromAssignmentPatternType(node); - case RestElementType -> fromRestElementType(node); - case ArrayPatternType -> fromArrayPatternType(node); - case ObjectPatternType -> fromObjectPatternType(node); - case PrivateIdentifierType -> fromPrivateIdentifierType(node); - case NewExpressionType -> fromNewExpressionType(node); - case SuperType -> fromSuperType(node); - case MetaPropertyType -> fromMetaPropertyType(node); - case MemberExpressionType -> fromMemberExpressionType(node); - case LogicalExpressionType -> fromLogicalExpressionType(node); - case ImportExpressionType -> fromImportExpressionType(node); - case BlockStatementType -> fromBlockStatementType(node); - case ConditionalExpressionType -> fromConditionalExpressionType(node); - case ClassExpressionType -> fromClassExpressionType(node); - case ClassBodyType -> fromClassBodyType(node); - case StaticBlockType -> fromStaticBlockType(node); - case PropertyDefinitionType -> fromPropertyDefinitionType(node); - case MethodDefinitionType -> fromMethodDefinitionType(node); - case ChainExpressionType -> fromChainExpressionType(node); - case CallExpressionType -> fromCallExpressionType(node); - case BinaryExpressionType -> fromBinaryExpressionType(node); - case AwaitExpressionType -> fromAwaitExpressionType(node); - case AssignmentExpressionType -> fromAssignmentExpressionType(node); - case ArrowFunctionExpressionType -> fromArrowFunctionExpressionType(node); - case ArrayExpressionType -> fromArrayExpressionType(node); - case ClassDeclarationType -> fromClassDeclarationType(node); - case FunctionDeclarationType -> fromFunctionDeclarationType(node); - case ExportNamedDeclarationType -> fromExportNamedDeclarationType(node); - case ExportSpecifierType -> fromExportSpecifierType(node); - case VariableDeclarationType -> fromVariableDeclarationType(node); - case VariableDeclaratorType -> fromVariableDeclaratorType(node); - case ImportDeclarationType -> fromImportDeclarationType(node); - case ImportNamespaceSpecifierType -> fromImportNamespaceSpecifierType(node); - case ImportDefaultSpecifierType -> fromImportDefaultSpecifierType(node); - case ImportSpecifierType -> fromImportSpecifierType(node); - case ForOfStatementType -> fromForOfStatementType(node); - case ForInStatementType -> fromForInStatementType(node); - case ForStatementType -> fromForStatementType(node); - case DoWhileStatementType -> fromDoWhileStatementType(node); - case WhileStatementType -> fromWhileStatementType(node); - case TryStatementType -> fromTryStatementType(node); - case CatchClauseType -> fromCatchClauseType(node); - case ThrowStatementType -> fromThrowStatementType(node); - case SwitchStatementType -> fromSwitchStatementType(node); - case SwitchCaseType -> fromSwitchCaseType(node); - case IfStatementType -> fromIfStatementType(node); - case ContinueStatementType -> fromContinueStatementType(node); - case BreakStatementType -> fromBreakStatementType(node); - case LabeledStatementType -> fromLabeledStatementType(node); - case ReturnStatementType -> fromReturnStatementType(node); - case WithStatementType -> fromWithStatementType(node); - case DebuggerStatementType -> fromDebuggerStatementType(node); - case EmptyStatementType -> fromEmptyStatementType(node); - case ExpressionStatementType -> { - if (node.getExpressionStatement().hasDirective()) { - yield fromDirective(node); - } else { - yield fromExpressionStatementType(node); + ESTree.Node estreeNode = + switch (node.getType()) { + case ProgramType -> fromProgramType(node); + case ExportAllDeclarationType -> fromExportAllDeclarationType(node); + case IdentifierType -> fromIdentifierType(node); + case ExportDefaultDeclarationType -> fromExportDefaultDeclarationType(node); + case YieldExpressionType -> fromYieldExpressionType(node); + case UpdateExpressionType -> fromUpdateExpressionType(node); + case UnaryExpressionType -> fromUnaryExpressionType(node); + case ThisExpressionType -> fromThisExpressionType(node); + case TemplateLiteralType -> fromTemplateLiteralType(node); + case TaggedTemplateExpressionType -> fromTaggedTemplateExpressionType(node); + case SequenceExpressionType -> fromSequenceExpressionType(node); + case ObjectExpressionType -> fromObjectExpressionType(node); + case SpreadElementType -> fromSpreadElementType(node); + case PropertyType -> fromPropertyType(node); + case AssignmentPatternType -> fromAssignmentPatternType(node); + case RestElementType -> fromRestElementType(node); + case ArrayPatternType -> fromArrayPatternType(node); + case ObjectPatternType -> fromObjectPatternType(node); + case PrivateIdentifierType -> fromPrivateIdentifierType(node); + case NewExpressionType -> fromNewExpressionType(node); + case SuperType -> fromSuperType(node); + case MetaPropertyType -> fromMetaPropertyType(node); + case MemberExpressionType -> fromMemberExpressionType(node); + case LogicalExpressionType -> fromLogicalExpressionType(node); + case ImportExpressionType -> fromImportExpressionType(node); + case BlockStatementType -> fromBlockStatementType(node); + case ConditionalExpressionType -> fromConditionalExpressionType(node); + case ClassExpressionType -> fromClassExpressionType(node); + case ClassBodyType -> fromClassBodyType(node); + case StaticBlockType -> fromStaticBlockType(node); + case PropertyDefinitionType -> fromPropertyDefinitionType(node); + case MethodDefinitionType -> fromMethodDefinitionType(node); + case ChainExpressionType -> fromChainExpressionType(node); + case CallExpressionType -> fromCallExpressionType(node); + case BinaryExpressionType -> fromBinaryExpressionType(node); + case AwaitExpressionType -> fromAwaitExpressionType(node); + case AssignmentExpressionType -> fromAssignmentExpressionType(node); + case ArrowFunctionExpressionType -> fromArrowFunctionExpressionType(node); + case ArrayExpressionType -> fromArrayExpressionType(node); + case ClassDeclarationType -> fromClassDeclarationType(node); + case FunctionDeclarationType -> fromFunctionDeclarationType(node); + case ExportNamedDeclarationType -> fromExportNamedDeclarationType(node); + case ExportSpecifierType -> fromExportSpecifierType(node); + case VariableDeclarationType -> fromVariableDeclarationType(node); + case VariableDeclaratorType -> fromVariableDeclaratorType(node); + case ImportDeclarationType -> fromImportDeclarationType(node); + case ImportNamespaceSpecifierType -> fromImportNamespaceSpecifierType(node); + case ImportDefaultSpecifierType -> fromImportDefaultSpecifierType(node); + case ImportSpecifierType -> fromImportSpecifierType(node); + case ForOfStatementType -> fromForOfStatementType(node); + case ForInStatementType -> fromForInStatementType(node); + case ForStatementType -> fromForStatementType(node); + case DoWhileStatementType -> fromDoWhileStatementType(node); + case WhileStatementType -> fromWhileStatementType(node); + case TryStatementType -> fromTryStatementType(node); + case CatchClauseType -> fromCatchClauseType(node); + case ThrowStatementType -> fromThrowStatementType(node); + case SwitchStatementType -> fromSwitchStatementType(node); + case SwitchCaseType -> fromSwitchCaseType(node); + case IfStatementType -> fromIfStatementType(node); + case ContinueStatementType -> fromContinueStatementType(node); + case BreakStatementType -> fromBreakStatementType(node); + case LabeledStatementType -> fromLabeledStatementType(node); + case ReturnStatementType -> fromReturnStatementType(node); + case WithStatementType -> fromWithStatementType(node); + case DebuggerStatementType -> fromDebuggerStatementType(node); + case EmptyStatementType -> fromEmptyStatementType(node); + case ExpressionStatementType -> { + if (node.getExpressionStatement().hasDirective()) { + yield fromDirective(node); + } else { + yield fromExpressionStatementType(node); + } } - } - case LiteralType -> fromLiteralType(node); - case TemplateElementType -> fromTemplateElementType(node); - case FunctionExpressionType -> fromFunctionExpressionType(node); - case ExportAssignmentType -> fromExportAssignment(node); - case UnknownNodeType -> fromUnknownNodeType(node); - case UNRECOGNIZED -> - throw new IllegalArgumentException("Unknown node type: " + node.getType() + " at " + node.getLoc()); - }; + case LiteralType -> fromLiteralType(node); + case TemplateElementType -> fromTemplateElementType(node); + case FunctionExpressionType -> fromFunctionExpressionType(node); + case ExportAssignmentType -> fromExportAssignment(node); + case UnknownNodeType -> fromUnknownNodeType(node); + case UNRECOGNIZED -> throw new IllegalArgumentException( + "Unknown node type: " + node.getType() + " at " + node.getLoc() + ); + }; if (!clazz.isInstance(estreeNode)) { throw new IllegalStateException("Expected " + clazz + " but got " + estreeNode.getClass()); } @@ -193,67 +195,86 @@ private static List from(List bodyList, Class clazz) { return bodyList.stream().map(n -> from(n, clazz)).toList(); } - private static ESTree.Location fromLocation(SourceLocation location) { - return new ESTree.Location(new ESTree.Position(location.getStart().getLine(), location.getStart().getColumn()), - new ESTree.Position(location.getEnd().getLine(), location.getEnd().getColumn())); + return new ESTree.Location( + new ESTree.Position(location.getStart().getLine(), location.getStart().getColumn()), + new ESTree.Position(location.getEnd().getLine(), location.getEnd().getColumn()) + ); } private static ESTree.Program fromProgramType(Node node) { Program program = node.getProgram(); - return new ESTree.Program(fromLocation(node.getLoc()), + return new ESTree.Program( + fromLocation(node.getLoc()), program.getSourceType(), - from(program.getBodyList(), ESTree.DirectiveOrModuleDeclarationOrStatement.class)); + from(program.getBodyList(), ESTree.DirectiveOrModuleDeclarationOrStatement.class) + ); } private static ESTree.ExportAllDeclaration fromExportAllDeclarationType(Node node) { ExportAllDeclaration exportAllDeclaration = node.getExportAllDeclaration(); - return new ESTree.ExportAllDeclaration(fromLocation(node.getLoc()), - exportAllDeclaration.hasExported() ? - Optional.of(from(exportAllDeclaration.getExported(), ESTree.IdentifierOrLiteral.class)) : - Optional.empty(), - from(exportAllDeclaration.getSource(), ESTree.Literal.class)); + return new ESTree.ExportAllDeclaration( + fromLocation(node.getLoc()), + exportAllDeclaration.hasExported() + ? Optional.of(from(exportAllDeclaration.getExported(), ESTree.IdentifierOrLiteral.class)) + : Optional.empty(), + from(exportAllDeclaration.getSource(), ESTree.Literal.class) + ); } private static ESTree.ExportAssignment fromExportAssignment(Node node) { ExportAssignment exportAssignment = node.getExportAssignment(); - return new ESTree.ExportAssignment(fromLocation(node.getLoc()), - from(exportAssignment.getExpression(), ESTree.Expression.class)); + return new ESTree.ExportAssignment( + fromLocation(node.getLoc()), + from(exportAssignment.getExpression(), ESTree.Expression.class) + ); } private static ESTree.Identifier fromIdentifierType(Node node) { Identifier identifier = node.getIdentifier(); - return new ESTree.Identifier(fromLocation(node.getLoc()), - identifier.getName()); + return new ESTree.Identifier(fromLocation(node.getLoc()), identifier.getName()); } private static ESTree.ExportDefaultDeclaration fromExportDefaultDeclarationType(Node node) { ExportDefaultDeclaration exportDefaultDeclaration = node.getExportDefaultDeclaration(); - return new ESTree.ExportDefaultDeclaration(fromLocation(node.getLoc()), - from(exportDefaultDeclaration.getDeclaration(), ESTree.ExpressionOrClassDeclarationOrFunctionDeclaration.class)); + return new ESTree.ExportDefaultDeclaration( + fromLocation(node.getLoc()), + from( + exportDefaultDeclaration.getDeclaration(), + ESTree.ExpressionOrClassDeclarationOrFunctionDeclaration.class + ) + ); } private static ESTree.YieldExpression fromYieldExpressionType(Node node) { YieldExpression yieldExpression = node.getYieldExpression(); - return new ESTree.YieldExpression(fromLocation(node.getLoc()), - yieldExpression.hasArgument() ? Optional.of(from(yieldExpression.getArgument(), ESTree.Expression.class)) : Optional.empty(), - yieldExpression.getDelegate()); + return new ESTree.YieldExpression( + fromLocation(node.getLoc()), + yieldExpression.hasArgument() + ? Optional.of(from(yieldExpression.getArgument(), ESTree.Expression.class)) + : Optional.empty(), + yieldExpression.getDelegate() + ); } private static ESTree.UpdateExpression fromUpdateExpressionType(Node node) { UpdateExpression updateExpression = node.getUpdateExpression(); - return new ESTree.UpdateExpression(fromLocation(node.getLoc()), + return new ESTree.UpdateExpression( + fromLocation(node.getLoc()), ESTree.UpdateOperator.from(updateExpression.getOperator()), from(updateExpression.getArgument(), ESTree.Expression.class), - updateExpression.getPrefix()); + updateExpression.getPrefix() + ); } private static ESTree.UnaryExpression fromUnaryExpressionType(Node node) { UnaryExpression unaryExpression = node.getUnaryExpression(); - return new ESTree.UnaryExpression(fromLocation(node.getLoc()), + return new ESTree.UnaryExpression( + fromLocation(node.getLoc()), ESTree.UnaryOperator.from(unaryExpression.getOperator()), unaryExpression.getPrefix(), - from(unaryExpression.getArgument(), ESTree.Expression.class)); + from(unaryExpression.getArgument(), ESTree.Expression.class) + ); } private static ESTree.ThisExpression fromThisExpressionType(Node node) { @@ -262,87 +283,110 @@ private static ESTree.ThisExpression fromThisExpressionType(Node node) { private static ESTree.TemplateLiteral fromTemplateLiteralType(Node node) { TemplateLiteral templateLiteral = node.getTemplateLiteral(); - return new ESTree.TemplateLiteral(fromLocation(node.getLoc()), + return new ESTree.TemplateLiteral( + fromLocation(node.getLoc()), from(templateLiteral.getQuasisList(), ESTree.TemplateElement.class), - from(templateLiteral.getExpressionsList(), ESTree.Expression.class)); + from(templateLiteral.getExpressionsList(), ESTree.Expression.class) + ); } private static ESTree.TaggedTemplateExpression fromTaggedTemplateExpressionType(Node node) { TaggedTemplateExpression taggedTemplateExpression = node.getTaggedTemplateExpression(); - return new ESTree.TaggedTemplateExpression(fromLocation(node.getLoc()), + return new ESTree.TaggedTemplateExpression( + fromLocation(node.getLoc()), from(taggedTemplateExpression.getTag(), ESTree.Expression.class), - from(taggedTemplateExpression.getQuasi(), ESTree.TemplateLiteral.class)); + from(taggedTemplateExpression.getQuasi(), ESTree.TemplateLiteral.class) + ); } private static ESTree.SequenceExpression fromSequenceExpressionType(Node node) { SequenceExpression sequenceExpression = node.getSequenceExpression(); - return new ESTree.SequenceExpression(fromLocation(node.getLoc()), - from(sequenceExpression.getExpressionsList(), ESTree.Expression.class)); + return new ESTree.SequenceExpression( + fromLocation(node.getLoc()), + from(sequenceExpression.getExpressionsList(), ESTree.Expression.class) + ); } private static ESTree.ObjectExpression fromObjectExpressionType(Node node) { ObjectExpression objectExpression = node.getObjectExpression(); - return new ESTree.ObjectExpression(fromLocation(node.getLoc()), - from(objectExpression.getPropertiesList(), ESTree.PropertyOrSpreadElement.class)); + return new ESTree.ObjectExpression( + fromLocation(node.getLoc()), + from(objectExpression.getPropertiesList(), ESTree.PropertyOrSpreadElement.class) + ); } private static ESTree.SpreadElement fromSpreadElementType(Node node) { SpreadElement spreadElement = node.getSpreadElement(); - return new ESTree.SpreadElement(fromLocation(node.getLoc()), - from(spreadElement.getArgument(), ESTree.Expression.class)); + return new ESTree.SpreadElement( + fromLocation(node.getLoc()), + from(spreadElement.getArgument(), ESTree.Expression.class) + ); } private static ESTree.Property fromPropertyType(Node node) { Property property = node.getProperty(); - return new ESTree.Property(fromLocation(node.getLoc()), + return new ESTree.Property( + fromLocation(node.getLoc()), from(property.getKey(), ESTree.ExpressionOrPrivateIdentifier.class), from(property.getValue(), ESTree.ExpressionOrPattern.class), property.getKind(), property.getMethod(), property.getShorthand(), - property.getComputed()); + property.getComputed() + ); } private static ESTree.AssignmentPattern fromAssignmentPatternType(Node node) { AssignmentPattern assignmentPattern = node.getAssignmentPattern(); - return new ESTree.AssignmentPattern(fromLocation(node.getLoc()), + return new ESTree.AssignmentPattern( + fromLocation(node.getLoc()), from(assignmentPattern.getLeft(), ESTree.Pattern.class), - from(assignmentPattern.getRight(), ESTree.Expression.class)); + from(assignmentPattern.getRight(), ESTree.Expression.class) + ); } private static ESTree.RestElement fromRestElementType(Node node) { RestElement restElement = node.getRestElement(); - return new ESTree.RestElement(fromLocation(node.getLoc()), - from(restElement.getArgument(), ESTree.Pattern.class)); + return new ESTree.RestElement( + fromLocation(node.getLoc()), + from(restElement.getArgument(), ESTree.Pattern.class) + ); } private static ESTree.ArrayPattern fromArrayPatternType(Node node) { ArrayPattern arrayPattern = node.getArrayPattern(); - return new ESTree.ArrayPattern(fromLocation(node.getLoc()), - arrayPattern.getElementsList().stream().map(ESTreeFactory::fromArrayPatternElement).toList()); + return new ESTree.ArrayPattern( + fromLocation(node.getLoc()), + arrayPattern.getElementsList().stream().map(ESTreeFactory::fromArrayPatternElement).toList() + ); } private static Optional fromArrayPatternElement(ArrayElement element) { - return element.hasElement() ? Optional.of(from(element.getElement(), ESTree.Pattern.class)) : Optional.empty(); + return element.hasElement() + ? Optional.of(from(element.getElement(), ESTree.Pattern.class)) + : Optional.empty(); } private static ESTree.ObjectPattern fromObjectPatternType(Node node) { ObjectPattern objectPattern = node.getObjectPattern(); - return new ESTree.ObjectPattern(fromLocation(node.getLoc()), - from(objectPattern.getPropertiesList(), ESTree.PropertyOrRestElement.class)); + return new ESTree.ObjectPattern( + fromLocation(node.getLoc()), + from(objectPattern.getPropertiesList(), ESTree.PropertyOrRestElement.class) + ); } private static ESTree.PrivateIdentifier fromPrivateIdentifierType(Node node) { PrivateIdentifier privateIdentifier = node.getPrivateIdentifier(); - return new ESTree.PrivateIdentifier(fromLocation(node.getLoc()), - privateIdentifier.getName()); + return new ESTree.PrivateIdentifier(fromLocation(node.getLoc()), privateIdentifier.getName()); } private static ESTree.NewExpression fromNewExpressionType(Node node) { NewExpression newExpression = node.getNewExpression(); - return new ESTree.NewExpression(fromLocation(node.getLoc()), + return new ESTree.NewExpression( + fromLocation(node.getLoc()), from(newExpression.getCallee(), ESTree.ExpressionOrSuper.class), - from(newExpression.getArgumentsList(), ESTree.ExpressionOrSpreadElement.class)); + from(newExpression.getArgumentsList(), ESTree.ExpressionOrSpreadElement.class) + ); } private static ESTree.Super fromSuperType(Node node) { @@ -351,327 +395,468 @@ private static ESTree.Super fromSuperType(Node node) { private static ESTree.MetaProperty fromMetaPropertyType(Node node) { MetaProperty metaProperty = node.getMetaProperty(); - return new ESTree.MetaProperty(fromLocation(node.getLoc()), + return new ESTree.MetaProperty( + fromLocation(node.getLoc()), from(metaProperty.getMeta(), ESTree.Identifier.class), - from(metaProperty.getProperty(), ESTree.Identifier.class)); + from(metaProperty.getProperty(), ESTree.Identifier.class) + ); } private static ESTree.MemberExpression fromMemberExpressionType(Node node) { MemberExpression memberExpression = node.getMemberExpression(); - return new ESTree.MemberExpression(fromLocation(node.getLoc()), + return new ESTree.MemberExpression( + fromLocation(node.getLoc()), from(memberExpression.getObject(), ESTree.ExpressionOrSuper.class), from(memberExpression.getProperty(), ESTree.ExpressionOrPrivateIdentifier.class), memberExpression.getComputed(), - memberExpression.getOptional()); + memberExpression.getOptional() + ); } private static ESTree.LogicalExpression fromLogicalExpressionType(Node node) { LogicalExpression logicalExpression = node.getLogicalExpression(); - return new ESTree.LogicalExpression(fromLocation(node.getLoc()), + return new ESTree.LogicalExpression( + fromLocation(node.getLoc()), ESTree.LogicalOperator.from(logicalExpression.getOperator()), from(logicalExpression.getLeft(), ESTree.Expression.class), - from(logicalExpression.getRight(), ESTree.Expression.class)); + from(logicalExpression.getRight(), ESTree.Expression.class) + ); } private static ESTree.ImportExpression fromImportExpressionType(Node node) { ImportExpression importExpression = node.getImportExpression(); - return new ESTree.ImportExpression(fromLocation(node.getLoc()), - from(importExpression.getSource(), ESTree.Expression.class)); + return new ESTree.ImportExpression( + fromLocation(node.getLoc()), + from(importExpression.getSource(), ESTree.Expression.class) + ); } private static ESTree.BlockStatement fromBlockStatementType(Node node) { BlockStatement blockStatement = node.getBlockStatement(); - return new ESTree.BlockStatement(fromLocation(node.getLoc()), - from(blockStatement.getBodyList(), ESTree.Statement.class)); + return new ESTree.BlockStatement( + fromLocation(node.getLoc()), + from(blockStatement.getBodyList(), ESTree.Statement.class) + ); } private static ESTree.ConditionalExpression fromConditionalExpressionType(Node node) { ConditionalExpression conditionalExpression = node.getConditionalExpression(); - return new ESTree.ConditionalExpression(fromLocation(node.getLoc()), + return new ESTree.ConditionalExpression( + fromLocation(node.getLoc()), from(conditionalExpression.getTest(), ESTree.Expression.class), from(conditionalExpression.getAlternate(), ESTree.Expression.class), - from(conditionalExpression.getConsequent(), ESTree.Expression.class)); + from(conditionalExpression.getConsequent(), ESTree.Expression.class) + ); } private static ESTree.ClassExpression fromClassExpressionType(Node node) { ClassExpression classExpression = node.getClassExpression(); - return new ESTree.ClassExpression(fromLocation(node.getLoc()), - classExpression.hasId() ? Optional.of(from(classExpression.getId(), ESTree.Identifier.class)) : Optional.empty(), - classExpression.hasSuperClass() ? Optional.of(from(classExpression.getSuperClass(), ESTree.Expression.class)) : Optional.empty(), - from(classExpression.getBody(), ESTree.ClassBody.class)); + return new ESTree.ClassExpression( + fromLocation(node.getLoc()), + classExpression.hasId() + ? Optional.of(from(classExpression.getId(), ESTree.Identifier.class)) + : Optional.empty(), + classExpression.hasSuperClass() + ? Optional.of(from(classExpression.getSuperClass(), ESTree.Expression.class)) + : Optional.empty(), + from(classExpression.getBody(), ESTree.ClassBody.class) + ); } private static ESTree.ClassBody fromClassBodyType(Node node) { ClassBody classBody = node.getClassBody(); - return new ESTree.ClassBody(fromLocation(node.getLoc()), - from(classBody.getBodyList(), ESTree.MethodDefinitionOrPropertyDefinitionOrStaticBlock.class)); + return new ESTree.ClassBody( + fromLocation(node.getLoc()), + from(classBody.getBodyList(), ESTree.MethodDefinitionOrPropertyDefinitionOrStaticBlock.class) + ); } private static ESTree.StaticBlock fromStaticBlockType(Node node) { StaticBlock staticBlock = node.getStaticBlock(); - return new ESTree.StaticBlock(fromLocation(node.getLoc()), from(staticBlock.getBodyList(), ESTree.Statement.class)); + return new ESTree.StaticBlock( + fromLocation(node.getLoc()), + from(staticBlock.getBodyList(), ESTree.Statement.class) + ); } private static ESTree.PropertyDefinition fromPropertyDefinitionType(Node node) { PropertyDefinition propertyDefinition = node.getPropertyDefinition(); - return new ESTree.PropertyDefinition(fromLocation(node.getLoc()), + return new ESTree.PropertyDefinition( + fromLocation(node.getLoc()), from(propertyDefinition.getKey(), ESTree.ExpressionOrPrivateIdentifier.class), - propertyDefinition.hasValue() ? Optional.of(from(propertyDefinition.getValue(), ESTree.Expression.class)) : Optional.empty(), + propertyDefinition.hasValue() + ? Optional.of(from(propertyDefinition.getValue(), ESTree.Expression.class)) + : Optional.empty(), propertyDefinition.getComputed(), - propertyDefinition.getStatic()); + propertyDefinition.getStatic() + ); } private static ESTree.MethodDefinition fromMethodDefinitionType(Node node) { MethodDefinition methodDefinition = node.getMethodDefinition(); - return new ESTree.MethodDefinition(fromLocation(node.getLoc()), + return new ESTree.MethodDefinition( + fromLocation(node.getLoc()), from(methodDefinition.getKey(), ESTree.ExpressionOrPrivateIdentifier.class), from(methodDefinition.getValue(), ESTree.FunctionExpression.class), methodDefinition.getKind(), - methodDefinition.getComputed(), methodDefinition.getStatic()); + methodDefinition.getComputed(), + methodDefinition.getStatic() + ); } private static ESTree.ChainExpression fromChainExpressionType(Node node) { ChainExpression chainExpression = node.getChainExpression(); - return new ESTree.ChainExpression(fromLocation(node.getLoc()), - from(chainExpression.getExpression(), ESTree.ChainElement.class)); + return new ESTree.ChainExpression( + fromLocation(node.getLoc()), + from(chainExpression.getExpression(), ESTree.ChainElement.class) + ); } private static ESTree.CallExpression fromCallExpressionType(Node node) { CallExpression callExpression = node.getCallExpression(); - return new ESTree.SimpleCallExpression(fromLocation(node.getLoc()), + return new ESTree.SimpleCallExpression( + fromLocation(node.getLoc()), callExpression.getOptional(), from(callExpression.getCallee(), ESTree.ExpressionOrSuper.class), - from(callExpression.getArgumentsList(), ESTree.ExpressionOrSpreadElement.class)); + from(callExpression.getArgumentsList(), ESTree.ExpressionOrSpreadElement.class) + ); } private static ESTree.BinaryExpression fromBinaryExpressionType(Node node) { BinaryExpression binaryExpression = node.getBinaryExpression(); - return new ESTree.BinaryExpression(fromLocation(node.getLoc()), + return new ESTree.BinaryExpression( + fromLocation(node.getLoc()), ESTree.BinaryOperator.from(binaryExpression.getOperator()), from(binaryExpression.getLeft(), ESTree.Expression.class), - from(binaryExpression.getRight(), ESTree.Expression.class)); + from(binaryExpression.getRight(), ESTree.Expression.class) + ); } private static ESTree.AwaitExpression fromAwaitExpressionType(Node node) { AwaitExpression awaitExpression = node.getAwaitExpression(); - return new ESTree.AwaitExpression(fromLocation(node.getLoc()), - from(awaitExpression.getArgument(), ESTree.Expression.class)); + return new ESTree.AwaitExpression( + fromLocation(node.getLoc()), + from(awaitExpression.getArgument(), ESTree.Expression.class) + ); } private static ESTree.AssignmentExpression fromAssignmentExpressionType(Node node) { AssignmentExpression assignmentExpression = node.getAssignmentExpression(); - return new ESTree.AssignmentExpression(fromLocation(node.getLoc()), + return new ESTree.AssignmentExpression( + fromLocation(node.getLoc()), ESTree.AssignmentOperator.from(assignmentExpression.getOperator()), from(assignmentExpression.getLeft(), ESTree.MemberExpressionOrPattern.class), - from(assignmentExpression.getRight(), ESTree.Expression.class)); + from(assignmentExpression.getRight(), ESTree.Expression.class) + ); } private static ESTree.ArrowFunctionExpression fromArrowFunctionExpressionType(Node node) { ArrowFunctionExpression arrowFunctionExpression = node.getArrowFunctionExpression(); - return new ESTree.ArrowFunctionExpression(fromLocation(node.getLoc()), + return new ESTree.ArrowFunctionExpression( + fromLocation(node.getLoc()), arrowFunctionExpression.getExpression(), from(arrowFunctionExpression.getBody(), ESTree.BlockStatementOrExpression.class), from(arrowFunctionExpression.getParamsList(), ESTree.Pattern.class), arrowFunctionExpression.getGenerator(), - arrowFunctionExpression.getAsync()); + arrowFunctionExpression.getAsync() + ); } private static ESTree.ArrayExpression fromArrayExpressionType(Node node) { ArrayExpression arrayExpression = node.getArrayExpression(); - return new ESTree.ArrayExpression(fromLocation(node.getLoc()), - arrayExpression.getElementsList().stream().map(ESTreeFactory::fromArrayExpressionElement).toList()); + return new ESTree.ArrayExpression( + fromLocation(node.getLoc()), + arrayExpression + .getElementsList() + .stream() + .map(ESTreeFactory::fromArrayExpressionElement) + .toList() + ); } - private static Optional fromArrayExpressionElement(ArrayElement element) { - return element.hasElement() ? Optional.of(from(element.getElement(), ESTree.ExpressionOrSpreadElement.class)) : Optional.empty(); + private static Optional fromArrayExpressionElement( + ArrayElement element + ) { + return element.hasElement() + ? Optional.of(from(element.getElement(), ESTree.ExpressionOrSpreadElement.class)) + : Optional.empty(); } private static ESTree.ClassDeclaration fromClassDeclarationType(Node node) { ClassDeclaration classDeclaration = node.getClassDeclaration(); - return new ESTree.ClassDeclaration(fromLocation(node.getLoc()), - classDeclaration.hasId() ? Optional.of(from(classDeclaration.getId(), ESTree.Identifier.class)) : Optional.empty(), - classDeclaration.hasSuperClass() ? Optional.of(from(classDeclaration.getSuperClass(), ESTree.Expression.class)) : Optional.empty(), - from(classDeclaration.getBody(), ESTree.ClassBody.class)); + return new ESTree.ClassDeclaration( + fromLocation(node.getLoc()), + classDeclaration.hasId() + ? Optional.of(from(classDeclaration.getId(), ESTree.Identifier.class)) + : Optional.empty(), + classDeclaration.hasSuperClass() + ? Optional.of(from(classDeclaration.getSuperClass(), ESTree.Expression.class)) + : Optional.empty(), + from(classDeclaration.getBody(), ESTree.ClassBody.class) + ); } private static ESTree.FunctionDeclaration fromFunctionDeclarationType(Node node) { FunctionDeclaration functionDeclaration = node.getFunctionDeclaration(); - return new ESTree.FunctionDeclaration(fromLocation(node.getLoc()), - functionDeclaration.hasId() ? Optional.of(from(functionDeclaration.getId(), ESTree.Identifier.class)) : Optional.empty(), + return new ESTree.FunctionDeclaration( + fromLocation(node.getLoc()), + functionDeclaration.hasId() + ? Optional.of(from(functionDeclaration.getId(), ESTree.Identifier.class)) + : Optional.empty(), from(functionDeclaration.getBody(), ESTree.BlockStatement.class), from(functionDeclaration.getParamsList(), ESTree.Pattern.class), functionDeclaration.getGenerator(), - functionDeclaration.getAsync()); + functionDeclaration.getAsync() + ); } private static ESTree.ExportNamedDeclaration fromExportNamedDeclarationType(Node node) { ExportNamedDeclaration exportNamedDeclaration = node.getExportNamedDeclaration(); - return new ESTree.ExportNamedDeclaration(fromLocation(node.getLoc()), - exportNamedDeclaration.hasDeclaration() ? Optional.of(from(exportNamedDeclaration.getDeclaration(), ESTree.Declaration.class)) : Optional.empty(), + return new ESTree.ExportNamedDeclaration( + fromLocation(node.getLoc()), + exportNamedDeclaration.hasDeclaration() + ? Optional.of(from(exportNamedDeclaration.getDeclaration(), ESTree.Declaration.class)) + : Optional.empty(), from(exportNamedDeclaration.getSpecifiersList(), ESTree.ExportSpecifier.class), - exportNamedDeclaration.hasSource() ? Optional.of(from(exportNamedDeclaration.getSource(), ESTree.Literal.class)) : Optional.empty()); + exportNamedDeclaration.hasSource() + ? Optional.of(from(exportNamedDeclaration.getSource(), ESTree.Literal.class)) + : Optional.empty() + ); } private static ESTree.ExportSpecifier fromExportSpecifierType(Node node) { ExportSpecifier exportSpecifier = node.getExportSpecifier(); - return new ESTree.ExportSpecifier(fromLocation(node.getLoc()), + return new ESTree.ExportSpecifier( + fromLocation(node.getLoc()), from(exportSpecifier.getExported(), ESTree.Identifier.class), - from(exportSpecifier.getLocal(), ESTree.Identifier.class)); + from(exportSpecifier.getLocal(), ESTree.Identifier.class) + ); } private static ESTree.VariableDeclaration fromVariableDeclarationType(Node node) { VariableDeclaration variableDeclaration = node.getVariableDeclaration(); - return new ESTree.VariableDeclaration(fromLocation(node.getLoc()), + return new ESTree.VariableDeclaration( + fromLocation(node.getLoc()), from(variableDeclaration.getDeclarationsList(), ESTree.VariableDeclarator.class), - variableDeclaration.getKind()); + variableDeclaration.getKind() + ); } private static ESTree.VariableDeclarator fromVariableDeclaratorType(Node node) { VariableDeclarator variableDeclarator = node.getVariableDeclarator(); - return new ESTree.VariableDeclarator(fromLocation(node.getLoc()), + return new ESTree.VariableDeclarator( + fromLocation(node.getLoc()), from(variableDeclarator.getId(), ESTree.Pattern.class), - variableDeclarator.hasInit() ? Optional.of(from(variableDeclarator.getInit(), ESTree.Expression.class)) : Optional.empty()); + variableDeclarator.hasInit() + ? Optional.of(from(variableDeclarator.getInit(), ESTree.Expression.class)) + : Optional.empty() + ); } private static ESTree.ImportDeclaration fromImportDeclarationType(Node node) { ImportDeclaration importDeclaration = node.getImportDeclaration(); - return new ESTree.ImportDeclaration(fromLocation(node.getLoc()), - from(importDeclaration.getSpecifiersList(), ESTree.ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier.class), - from(importDeclaration.getSource(), ESTree.Literal.class)); + return new ESTree.ImportDeclaration( + fromLocation(node.getLoc()), + from( + importDeclaration.getSpecifiersList(), + ESTree.ImportDefaultSpecifierOrImportNamespaceSpecifierOrImportSpecifier.class + ), + from(importDeclaration.getSource(), ESTree.Literal.class) + ); } private static ESTree.ImportNamespaceSpecifier fromImportNamespaceSpecifierType(Node node) { ImportNamespaceSpecifier importNamespaceSpecifier = node.getImportNamespaceSpecifier(); - return new ESTree.ImportNamespaceSpecifier(fromLocation(node.getLoc()), - from(importNamespaceSpecifier.getLocal(), ESTree.Identifier.class)); + return new ESTree.ImportNamespaceSpecifier( + fromLocation(node.getLoc()), + from(importNamespaceSpecifier.getLocal(), ESTree.Identifier.class) + ); } private static ESTree.ImportDefaultSpecifier fromImportDefaultSpecifierType(Node node) { ImportDefaultSpecifier importDefaultSpecifier = node.getImportDefaultSpecifier(); - return new ESTree.ImportDefaultSpecifier(fromLocation(node.getLoc()), - from(importDefaultSpecifier.getLocal(), ESTree.Identifier.class)); + return new ESTree.ImportDefaultSpecifier( + fromLocation(node.getLoc()), + from(importDefaultSpecifier.getLocal(), ESTree.Identifier.class) + ); } private static ESTree.ImportSpecifier fromImportSpecifierType(Node node) { ImportSpecifier importSpecifier = node.getImportSpecifier(); - return new ESTree.ImportSpecifier(fromLocation(node.getLoc()), + return new ESTree.ImportSpecifier( + fromLocation(node.getLoc()), from(importSpecifier.getImported(), ESTree.Identifier.class), - from(importSpecifier.getLocal(), ESTree.Identifier.class)); + from(importSpecifier.getLocal(), ESTree.Identifier.class) + ); } private static ESTree.ForOfStatement fromForOfStatementType(Node node) { ForOfStatement forOfStatement = node.getForOfStatement(); - return new ESTree.ForOfStatement(fromLocation(node.getLoc()), + return new ESTree.ForOfStatement( + fromLocation(node.getLoc()), forOfStatement.getAwait(), from(forOfStatement.getLeft(), ESTree.PatternOrVariableDeclaration.class), from(forOfStatement.getRight(), ESTree.Expression.class), - from(forOfStatement.getBody(), ESTree.Statement.class)); + from(forOfStatement.getBody(), ESTree.Statement.class) + ); } private static ESTree.ForInStatement fromForInStatementType(Node node) { ForInStatement forInStatement = node.getForInStatement(); - return new ESTree.ForInStatement(fromLocation(node.getLoc()), + return new ESTree.ForInStatement( + fromLocation(node.getLoc()), from(forInStatement.getLeft(), ESTree.PatternOrVariableDeclaration.class), from(forInStatement.getRight(), ESTree.Expression.class), - from(forInStatement.getBody(), ESTree.Statement.class)); + from(forInStatement.getBody(), ESTree.Statement.class) + ); } private static ESTree.ForStatement fromForStatementType(Node node) { ForStatement forStatement = node.getForStatement(); - return new ESTree.ForStatement(fromLocation(node.getLoc()), - forStatement.hasInit() ? Optional.of(from(forStatement.getInit(), ESTree.ExpressionOrVariableDeclaration.class)) : Optional.empty(), - forStatement.hasTest() ? Optional.of(from(forStatement.getTest(), ESTree.Expression.class)) : Optional.empty(), - forStatement.hasUpdate() ? Optional.of(from(forStatement.getUpdate(), ESTree.Expression.class)) : Optional.empty(), - from(forStatement.getBody(), ESTree.Statement.class)); + return new ESTree.ForStatement( + fromLocation(node.getLoc()), + forStatement.hasInit() + ? Optional.of(from(forStatement.getInit(), ESTree.ExpressionOrVariableDeclaration.class)) + : Optional.empty(), + forStatement.hasTest() + ? Optional.of(from(forStatement.getTest(), ESTree.Expression.class)) + : Optional.empty(), + forStatement.hasUpdate() + ? Optional.of(from(forStatement.getUpdate(), ESTree.Expression.class)) + : Optional.empty(), + from(forStatement.getBody(), ESTree.Statement.class) + ); } private static ESTree.DoWhileStatement fromDoWhileStatementType(Node node) { DoWhileStatement doWhileStatement = node.getDoWhileStatement(); - return new ESTree.DoWhileStatement(fromLocation(node.getLoc()), + return new ESTree.DoWhileStatement( + fromLocation(node.getLoc()), from(doWhileStatement.getBody(), ESTree.Statement.class), - from(doWhileStatement.getTest(), ESTree.Expression.class)); + from(doWhileStatement.getTest(), ESTree.Expression.class) + ); } private static ESTree.WhileStatement fromWhileStatementType(Node node) { WhileStatement whileStatement = node.getWhileStatement(); - return new ESTree.WhileStatement(fromLocation(node.getLoc()), + return new ESTree.WhileStatement( + fromLocation(node.getLoc()), from(whileStatement.getTest(), ESTree.Expression.class), - from(whileStatement.getBody(), ESTree.Statement.class)); + from(whileStatement.getBody(), ESTree.Statement.class) + ); } private static ESTree.TryStatement fromTryStatementType(Node node) { TryStatement tryStatement = node.getTryStatement(); - return new ESTree.TryStatement(fromLocation(node.getLoc()), + return new ESTree.TryStatement( + fromLocation(node.getLoc()), from(tryStatement.getBlock(), ESTree.BlockStatement.class), - tryStatement.hasHandler() ? Optional.of(from(tryStatement.getHandler(), ESTree.CatchClause.class)) : Optional.empty(), - tryStatement.hasFinalizer() ? Optional.of(from(tryStatement.getFinalizer(), ESTree.BlockStatement.class)) : Optional.empty()); + tryStatement.hasHandler() + ? Optional.of(from(tryStatement.getHandler(), ESTree.CatchClause.class)) + : Optional.empty(), + tryStatement.hasFinalizer() + ? Optional.of(from(tryStatement.getFinalizer(), ESTree.BlockStatement.class)) + : Optional.empty() + ); } private static ESTree.CatchClause fromCatchClauseType(Node node) { CatchClause catchClause = node.getCatchClause(); - return new ESTree.CatchClause(fromLocation(node.getLoc()), - catchClause.hasParam() ? Optional.of(from(catchClause.getParam(), ESTree.Pattern.class)) : Optional.empty(), - from(catchClause.getBody(), ESTree.BlockStatement.class)); + return new ESTree.CatchClause( + fromLocation(node.getLoc()), + catchClause.hasParam() + ? Optional.of(from(catchClause.getParam(), ESTree.Pattern.class)) + : Optional.empty(), + from(catchClause.getBody(), ESTree.BlockStatement.class) + ); } private static ESTree.ThrowStatement fromThrowStatementType(Node node) { ThrowStatement throwStatement = node.getThrowStatement(); - return new ESTree.ThrowStatement(fromLocation(node.getLoc()), - from(throwStatement.getArgument(), ESTree.Expression.class)); + return new ESTree.ThrowStatement( + fromLocation(node.getLoc()), + from(throwStatement.getArgument(), ESTree.Expression.class) + ); } private static ESTree.SwitchStatement fromSwitchStatementType(Node node) { SwitchStatement switchStatement = node.getSwitchStatement(); - return new ESTree.SwitchStatement(fromLocation(node.getLoc()), + return new ESTree.SwitchStatement( + fromLocation(node.getLoc()), from(switchStatement.getDiscriminant(), ESTree.Expression.class), - from(switchStatement.getCasesList(), ESTree.SwitchCase.class)); + from(switchStatement.getCasesList(), ESTree.SwitchCase.class) + ); } private static ESTree.SwitchCase fromSwitchCaseType(Node node) { SwitchCase switchCase = node.getSwitchCase(); - return new ESTree.SwitchCase(fromLocation(node.getLoc()), - switchCase.hasTest() ? Optional.of(from(switchCase.getTest(), ESTree.Expression.class)) : Optional.empty(), - from(switchCase.getConsequentList(), ESTree.Statement.class)); + return new ESTree.SwitchCase( + fromLocation(node.getLoc()), + switchCase.hasTest() + ? Optional.of(from(switchCase.getTest(), ESTree.Expression.class)) + : Optional.empty(), + from(switchCase.getConsequentList(), ESTree.Statement.class) + ); } private static ESTree.IfStatement fromIfStatementType(Node node) { IfStatement ifStatement = node.getIfStatement(); - return new ESTree.IfStatement(fromLocation(node.getLoc()), + return new ESTree.IfStatement( + fromLocation(node.getLoc()), from(ifStatement.getTest(), ESTree.Expression.class), from(ifStatement.getConsequent(), ESTree.Statement.class), - ifStatement.hasAlternate() ? Optional.of(from(ifStatement.getAlternate(), ESTree.Statement.class)) : Optional.empty()); + ifStatement.hasAlternate() + ? Optional.of(from(ifStatement.getAlternate(), ESTree.Statement.class)) + : Optional.empty() + ); } private static ESTree.ContinueStatement fromContinueStatementType(Node node) { ContinueStatement continueStatement = node.getContinueStatement(); - return new ESTree.ContinueStatement(fromLocation(node.getLoc()), - continueStatement.hasLabel() ? Optional.of(from(continueStatement.getLabel(), ESTree.Identifier.class)) : Optional.empty()); + return new ESTree.ContinueStatement( + fromLocation(node.getLoc()), + continueStatement.hasLabel() + ? Optional.of(from(continueStatement.getLabel(), ESTree.Identifier.class)) + : Optional.empty() + ); } private static ESTree.BreakStatement fromBreakStatementType(Node node) { BreakStatement breakStatement = node.getBreakStatement(); - return new ESTree.BreakStatement(fromLocation(node.getLoc()), - breakStatement.hasLabel() ? Optional.of(from(breakStatement.getLabel(), ESTree.Identifier.class)) : Optional.empty()); + return new ESTree.BreakStatement( + fromLocation(node.getLoc()), + breakStatement.hasLabel() + ? Optional.of(from(breakStatement.getLabel(), ESTree.Identifier.class)) + : Optional.empty() + ); } private static ESTree.LabeledStatement fromLabeledStatementType(Node node) { LabeledStatement labeledStatement = node.getLabeledStatement(); - return new ESTree.LabeledStatement(fromLocation(node.getLoc()), + return new ESTree.LabeledStatement( + fromLocation(node.getLoc()), from(labeledStatement.getLabel(), ESTree.Identifier.class), - from(labeledStatement.getBody(), ESTree.Statement.class)); + from(labeledStatement.getBody(), ESTree.Statement.class) + ); } private static ESTree.ReturnStatement fromReturnStatementType(Node node) { ReturnStatement returnStatement = node.getReturnStatement(); - return new ESTree.ReturnStatement(fromLocation(node.getLoc()), - returnStatement.hasArgument() ? Optional.of(from(returnStatement.getArgument(), ESTree.Expression.class)) : Optional.empty()); + return new ESTree.ReturnStatement( + fromLocation(node.getLoc()), + returnStatement.hasArgument() + ? Optional.of(from(returnStatement.getArgument(), ESTree.Expression.class)) + : Optional.empty() + ); } private static ESTree.WithStatement fromWithStatementType(Node node) { WithStatement withStatement = node.getWithStatement(); - return new ESTree.WithStatement(fromLocation(node.getLoc()), + return new ESTree.WithStatement( + fromLocation(node.getLoc()), from(withStatement.getObject(), ESTree.Expression.class), - from(withStatement.getBody(), ESTree.Statement.class)); + from(withStatement.getBody(), ESTree.Statement.class) + ); } private static ESTree.DebuggerStatement fromDebuggerStatementType(Node node) { @@ -684,37 +869,64 @@ private static ESTree.EmptyStatement fromEmptyStatementType(Node node) { private static ESTree.ExpressionStatement fromExpressionStatementType(Node node) { ExpressionStatement expressionStatement = node.getExpressionStatement(); - return new ESTree.ExpressionStatement(fromLocation(node.getLoc()), - from(expressionStatement.getExpression(), ESTree.Expression.class)); + return new ESTree.ExpressionStatement( + fromLocation(node.getLoc()), + from(expressionStatement.getExpression(), ESTree.Expression.class) + ); } private static ESTree.Directive fromDirective(Node node) { ExpressionStatement directive = node.getExpressionStatement(); - return new ESTree.Directive(fromLocation(node.getLoc()), + return new ESTree.Directive( + fromLocation(node.getLoc()), from(directive.getExpression(), ESTree.Literal.class), - directive.getDirective()); + directive.getDirective() + ); } private static ESTree.Literal fromLiteralType(Node node) { Literal literal = node.getLiteral(); if (literal.hasBigint()) { - return new ESTree.BigIntLiteral(fromLocation(node.getLoc()), new BigInteger(literal.getBigint()), literal.getBigint(), literal.getRaw()); + return new ESTree.BigIntLiteral( + fromLocation(node.getLoc()), + new BigInteger(literal.getBigint()), + literal.getBigint(), + literal.getRaw() + ); } else if (literal.hasPattern()) { - return new ESTree.RegExpLiteral(fromLocation(node.getLoc()), literal.getPattern(), literal.getFlags(), literal.getRaw()); + return new ESTree.RegExpLiteral( + fromLocation(node.getLoc()), + literal.getPattern(), + literal.getFlags(), + literal.getRaw() + ); } else { if (literal.hasValueNumber()) { - return new ESTree.SimpleLiteral(fromLocation(node.getLoc()), literal.getValueNumber(), node.getLiteral().getRaw()); + return new ESTree.SimpleLiteral( + fromLocation(node.getLoc()), + literal.getValueNumber(), + node.getLiteral().getRaw() + ); } else if (literal.hasValueBoolean()) { - return new ESTree.SimpleLiteral(fromLocation(node.getLoc()), literal.getValueBoolean(), node.getLiteral().getRaw()); + return new ESTree.SimpleLiteral( + fromLocation(node.getLoc()), + literal.getValueBoolean(), + node.getLiteral().getRaw() + ); } else { - return new ESTree.SimpleLiteral(fromLocation(node.getLoc()), literal.getValueString(), node.getLiteral().getRaw()); + return new ESTree.SimpleLiteral( + fromLocation(node.getLoc()), + literal.getValueString(), + node.getLiteral().getRaw() + ); } } } private static ESTree.TemplateElement fromTemplateElementType(Node node) { TemplateElement templateElement = node.getTemplateElement(); - return new ESTree.TemplateElement(fromLocation(node.getLoc()), + return new ESTree.TemplateElement( + fromLocation(node.getLoc()), templateElement.getTail(), templateElement.getCooked(), templateElement.getRaw() @@ -723,17 +935,20 @@ private static ESTree.TemplateElement fromTemplateElementType(Node node) { private static ESTree.FunctionExpression fromFunctionExpressionType(Node node) { FunctionExpression functionExpression = node.getFunctionExpression(); - return new ESTree.FunctionExpression(fromLocation(node.getLoc()), - functionExpression.hasId() ? Optional.of(from(functionExpression.getId(), ESTree.Identifier.class)) : Optional.empty(), + return new ESTree.FunctionExpression( + fromLocation(node.getLoc()), + functionExpression.hasId() + ? Optional.of(from(functionExpression.getId(), ESTree.Identifier.class)) + : Optional.empty(), from(functionExpression.getBody(), ESTree.BlockStatement.class), from(functionExpression.getParamsList(), ESTree.Pattern.class), functionExpression.getGenerator(), - functionExpression.getAsync()); + functionExpression.getAsync() + ); } private static ESTree.UnknownNode fromUnknownNodeType(Node node) { UnknownNode unknownNode = node.getUnknownNode(); return new ESTree.UnknownNode(fromLocation(node.getLoc()), unknownNode.getRawType()); } - } diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/EmbeddedNode.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/EmbeddedNode.java index 6718a4c82b5..c968f7be548 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/EmbeddedNode.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/EmbeddedNode.java @@ -111,7 +111,7 @@ static Platform detect(Environment env) { var lowerCaseOsName = osName.toLowerCase(Locale.ROOT); if (osName.contains("Windows") && isX64(env)) { return WIN_X64; - } else if (lowerCaseOsName.contains("linux") && isARM64(env) ) { + } else if (lowerCaseOsName.contains("linux") && isARM64(env)) { return LINUX_ARM64; } else if (lowerCaseOsName.contains("linux") && isX64(env)) { return env.isAlpine() ? LINUX_X64_MUSL : LINUX_X64; @@ -179,7 +179,12 @@ public void deploy() throws IOException { var targetRuntime = deployLocation.resolve(platform.binary()); var targetDirectory = targetRuntime.getParent(); var targetVersion = targetDirectory.resolve(VERSION_FILENAME); - LOG.info("Deploy location {}, tagetRuntime: {}, version: {}", deployLocation, targetRuntime, targetVersion); + LOG.info( + "Deploy location {}, tagetRuntime: {}, version: {}", + deployLocation, + targetRuntime, + targetVersion + ); // we assume that since the archive exists, the version file must as well var versionIs = getClass().getResourceAsStream(platform.versionPathInJar()); @@ -193,7 +198,8 @@ public void deploy() throws IOException { LOG.debug("Deployed node version {}", detected); isAvailable = true; } catch (Exception e) { - LOG.warn(""" + LOG.warn( + """ Embedded Node.js failed to deploy in {}. You can change the location by setting the option `sonar.userHome` or the environment variable `SONAR_USER_HOME`. Otherwise, it will default to {}. @@ -210,7 +216,9 @@ private static boolean isDifferent(InputStream newVersionIs, Path currentVersion var newVersionString = new String(newVersionIs.readAllBytes(), StandardCharsets.UTF_8); var currentVersionString = Files.readString(currentVersionPath); LOG.debug( - "Currently installed Node.js version: {}. Available version in analyzer: {}", currentVersionString, newVersionString + "Currently installed Node.js version: {}. Available version in analyzer: {}", + currentVersionString, + newVersionString ); return !newVersionString.equals(currentVersionString); } diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/Environment.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/Environment.java index 74b01499ce6..e94b609018d 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/Environment.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/Environment.java @@ -42,12 +42,11 @@ public Environment(Configuration configuration) { } public Path getSonarUserHome() { - return Stream - .of( - configuration.get("sonar.userHome").orElse(null), - System.getenv("SONAR_USER_HOME"), - defaultSonarUserHome() - ) + return Stream.of( + configuration.get("sonar.userHome").orElse(null), + System.getenv("SONAR_USER_HOME"), + defaultSonarUserHome() + ) .filter(Objects::nonNull) .findFirst() .map(Path::of) diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/FormDataUtils.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/FormDataUtils.java index b8fa779fef4..6b2acfee147 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/FormDataUtils.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/FormDataUtils.java @@ -121,8 +121,7 @@ private static List split(byte[] array, byte[] delimiter) { } int begin = 0; - outer: - for (int i = 0; i < array.length - delimiter.length + 1; i++) { + outer: for (int i = 0; i < array.length - delimiter.length + 1; i++) { for (int j = 0; j < delimiter.length; j++) { if (array[i + j] != delimiter[j]) { continue outer; diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/Http.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/Http.java index d43d18dcec3..b1b326afba0 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/Http.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/Http.java @@ -27,7 +27,6 @@ import org.slf4j.LoggerFactory; public interface Http { - static Http getJdkHttpClient() { return new JdkHttp(); } @@ -49,8 +48,7 @@ class JdkHttp implements Http { @Override public Response post(String json, URI uri, long timeoutSeconds) throws IOException { - var request = HttpRequest - .newBuilder() + var request = HttpRequest.newBuilder() .uri(uri) .timeout(Duration.ofSeconds(timeoutSeconds)) .header("Content-Type", "application/json") @@ -59,8 +57,7 @@ public Response post(String json, URI uri, long timeoutSeconds) throws IOExcepti try { var response = client.send(request, HttpResponse.BodyHandlers.ofByteArray()); - var contentType = response.headers().firstValue("Content-Type") - .orElse(null); + var contentType = response.headers().firstValue("Content-Type").orElse(null); return new Response(contentType, response.body()); } catch (InterruptedException e) { throw handleInterruptedException(e, "Request " + uri + " was interrupted."); @@ -68,7 +65,7 @@ public Response post(String json, URI uri, long timeoutSeconds) throws IOExcepti } @Override - public String get(URI uri) throws IOException{ + public String get(URI uri) throws IOException { var request = HttpRequest.newBuilder(uri).GET().build(); try { var response = client.send(request, HttpResponse.BodyHandlers.ofString()); @@ -86,7 +83,5 @@ private static IllegalStateException handleInterruptedException( Thread.currentThread().interrupt(); return new IllegalStateException(msg, e); } - } - } diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/RulesBundles.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/RulesBundles.java index 5b5ab5689c4..68162b45b00 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/RulesBundles.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/RulesBundles.java @@ -51,23 +51,17 @@ public RulesBundles() { public RulesBundles(RulesBundle[] rulesBundles) { bundles = List.of(rulesBundles); - bundleUrls = - Arrays - .stream(rulesBundles) - .map(bundle -> { - URL resource = bundle.getClass().getResource(bundle.bundlePath()); - if (resource == null) { - throw new IllegalStateException( - String.format( - "Resource for bundle %s from %s not found.", - bundle.bundlePath(), - bundle - ) - ); - } - return resource; - }) - .toList(); + bundleUrls = Arrays.stream(rulesBundles) + .map(bundle -> { + URL resource = bundle.getClass().getResource(bundle.bundlePath()); + if (resource == null) { + throw new IllegalStateException( + String.format("Resource for bundle %s from %s not found.", bundle.bundlePath(), bundle) + ); + } + return resource; + }) + .toList(); } /** diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/TsConfigFile.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/TsConfigFile.java index ed2fa88523c..62c2d3f5e1c 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/TsConfigFile.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/bridge/TsConfigFile.java @@ -51,9 +51,6 @@ public String toString() { } private static String normalizePath(String path) { - return Path - .of(path) - .toString() - .replaceAll("[\\\\/]", "/"); + return Path.of(path).toString().replaceAll("[\\\\/]", "/"); } } diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/nodejs/NodeCommandBuilderImpl.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/nodejs/NodeCommandBuilderImpl.java index 446b23b31ad..fbfcd315d57 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/nodejs/NodeCommandBuilderImpl.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/nodejs/NodeCommandBuilderImpl.java @@ -42,8 +42,7 @@ public class NodeCommandBuilderImpl implements NodeCommandBuilder { private static final Logger LOG = LoggerFactory.getLogger(NodeCommandBuilderImpl.class); public static final String NODE_EXECUTABLE_DEFAULT = "node"; - private static final String NODE_EXECUTABLE_DEFAULT_MACOS = - "package/bin/run-node"; + private static final String NODE_EXECUTABLE_DEFAULT_MACOS = "package/bin/run-node"; public static final String NODE_EXECUTABLE_PROPERTY = "sonar.nodejs.executable"; public static final String NODE_FORCE_HOST_PROPERTY = "sonar.nodejs.forceHost"; diff --git a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/nodejs/StreamConsumer.java b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/nodejs/StreamConsumer.java index 4fadbea7cc1..a3d84d58f9e 100644 --- a/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/nodejs/StreamConsumer.java +++ b/sonar-plugin/bridge/src/main/java/org/sonar/plugins/javascript/nodejs/StreamConsumer.java @@ -34,15 +34,13 @@ class StreamConsumer { private final ExecutorService executorService; StreamConsumer() { - executorService = - Executors.newCachedThreadPool(r -> { - Thread thread = new Thread(r); - thread.setName("nodejs-stream-consumer"); - thread.setDaemon(true); - thread.setUncaughtExceptionHandler((t, e) -> LOG.error("Error in thread " + t.getName(), e) - ); - return thread; - }); + executorService = Executors.newCachedThreadPool(r -> { + Thread thread = new Thread(r); + thread.setName("nodejs-stream-consumer"); + thread.setDaemon(true); + thread.setUncaughtExceptionHandler((t, e) -> LOG.error("Error in thread " + t.getName(), e)); + return thread; + }); } void consumeStream(InputStream inputStream, Consumer consumer) { diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/AnalysisModeTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/AnalysisModeTest.java index 99ade30f3d4..a069346c371 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/AnalysisModeTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/AnalysisModeTest.java @@ -73,8 +73,7 @@ void should_reflect_skippable_without_security_analysis() { var files = fileList(changedFiles(2), unchangedFiles(1), addedFiles(3)); assertThat( files.stream().map(mode::getLinterIdFor).allMatch(AnalysisMode.DEFAULT_LINTER_ID::equals) - ) - .isTrue(); + ).isTrue(); } @Test @@ -89,8 +88,7 @@ void should_reflect_main_branch_analysis() { var files = fileList(changedFiles(2), unchangedFiles(1), addedFiles(3)); assertThat( files.stream().map(mode::getLinterIdFor).allMatch(AnalysisMode.DEFAULT_LINTER_ID::equals) - ) - .isTrue(); + ).isTrue(); } @Test @@ -106,15 +104,14 @@ void should_reflect_pr_analysis() { verify(context).canSkipUnchangedFiles(); var files = fileList(changedFiles(2), unchangedFiles(1), addedFiles(3)); - assertThat(files.stream().map(mode::getLinterIdFor)) - .containsExactly( - AnalysisMode.DEFAULT_LINTER_ID, - AnalysisMode.DEFAULT_LINTER_ID, - AnalysisMode.UNCHANGED_LINTER_ID, - AnalysisMode.DEFAULT_LINTER_ID, - AnalysisMode.DEFAULT_LINTER_ID, - AnalysisMode.DEFAULT_LINTER_ID - ); + assertThat(files.stream().map(mode::getLinterIdFor)).containsExactly( + AnalysisMode.DEFAULT_LINTER_ID, + AnalysisMode.DEFAULT_LINTER_ID, + AnalysisMode.UNCHANGED_LINTER_ID, + AnalysisMode.DEFAULT_LINTER_ID, + AnalysisMode.DEFAULT_LINTER_ID, + AnalysisMode.DEFAULT_LINTER_ID + ); } @Test @@ -128,13 +125,11 @@ void should_filter_out_rules_for_html() { } private static List rules(String... keys) { - return Arrays - .stream(keys) + return Arrays.stream(keys) .map(key -> new EslintRule(key, emptyList(), emptyList(), "js")) .toList(); } - @SafeVarargs private static List fileList(Stream... streams) { return Arrays.stream(streams).flatMap(identity()).toList(); diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/BridgeServerImplTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/BridgeServerImplTest.java index 80a8be7a40e..4792fc6fce3 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/BridgeServerImplTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/BridgeServerImplTest.java @@ -108,8 +108,10 @@ public void setUp() { context.fileSystem().setWorkDir(workDir); serverConfig = BridgeServerConfig.fromSensorContext(context); tempFolder = new DefaultTempFolder(tempDir, true); - unsupportedEmbeddedRuntime = - new EmbeddedNode(mock(ProcessWrapper.class), createUnsupportedEnvironment()); + unsupportedEmbeddedRuntime = new EmbeddedNode( + mock(ProcessWrapper.class), + createUnsupportedEnvironment() + ); } @AfterEach @@ -136,27 +138,23 @@ void should_throw_when_not_existing_script() { @Test void should_throw_if_failed_to_build_node_command() { - NodeCommandBuilder nodeCommandBuilder = mock( - NodeCommandBuilder.class, - invocation -> { - if (NodeCommandBuilder.class.equals(invocation.getMethod().getReturnType())) { - return invocation.getMock(); - } else { - throw new NodeCommandException("msg"); - } + NodeCommandBuilder nodeCommandBuilder = mock(NodeCommandBuilder.class, invocation -> { + if (NodeCommandBuilder.class.equals(invocation.getMethod().getReturnType())) { + return invocation.getMock(); + } else { + throw new NodeCommandException("msg"); } - ); + }); - bridgeServer = - new BridgeServerImpl( - nodeCommandBuilder, - TEST_TIMEOUT_SECONDS, - testBundle, - emptyRulesBundles, - deprecationWarning, - tempFolder, - unsupportedEmbeddedRuntime - ); + bridgeServer = new BridgeServerImpl( + nodeCommandBuilder, + TEST_TIMEOUT_SECONDS, + testBundle, + emptyRulesBundles, + deprecationWarning, + tempFolder, + unsupportedEmbeddedRuntime + ); List deployedBundles = emptyList(); assertThatThrownBy(() -> bridgeServer.startServer(serverConfig, deployedBundles)) @@ -180,8 +178,7 @@ void should_get_answer_from_server() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); bridgeServer.startServer(serverConfig, emptyList()); - DefaultInputFile inputFile = TestInputFileBuilder - .create("foo", "foo.js") + DefaultInputFile inputFile = TestInputFileBuilder.create("foo", "foo.js") .setContents("alert('Fly, you fools!')") .build(); JsAnalysisRequest request = createRequest(inputFile); @@ -211,10 +208,9 @@ void test_init() throws Exception { Collections.emptyList() ); bridgeServer.stop(); - assertThat(logTester.logs()) - .contains( - "{\"linterId\":\"default\",\"rules\":[{\"key\":\"key\",\"fileTypeTarget\":[\"MAIN\"],\"configurations\":[\"config\"],\"language\":\"js\"}],\"environments\":[],\"globals\":[],\"baseDir\":\"\",\"exclusions\":[]}" - ); + assertThat(logTester.logs()).contains( + "{\"linterId\":\"default\",\"rules\":[{\"key\":\"key\",\"fileTypeTarget\":[\"MAIN\"],\"configurations\":[\"config\"],\"language\":\"js\"}],\"environments\":[],\"globals\":[],\"baseDir\":\"\",\"exclusions\":[]}" + ); } @Test @@ -222,12 +218,10 @@ void should_get_answer_from_server_for_ts_request() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); bridgeServer.startServer(serverConfig, emptyList()); - DefaultInputFile inputFile = TestInputFileBuilder - .create("foo", "foo.ts") + DefaultInputFile inputFile = TestInputFileBuilder.create("foo", "foo.ts") .setContents("alert('Fly, you fools!')") .build(); - DefaultInputFile tsConfig = TestInputFileBuilder - .create("foo", "tsconfig.json") + DefaultInputFile tsConfig = TestInputFileBuilder.create("foo", "tsconfig.json") .setContents("{\"compilerOptions\": {\"target\": \"es6\", \"allowJs\": true }}") .build(); JsAnalysisRequest request = new JsAnalysisRequest( @@ -250,8 +244,7 @@ void should_get_answer_from_server_for_yaml_request() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); bridgeServer.startServer(serverConfig, emptyList()); - DefaultInputFile inputFile = TestInputFileBuilder - .create("foo", "foo.yaml") + DefaultInputFile inputFile = TestInputFileBuilder.create("foo", "foo.yaml") .setContents("alert('Fly, you fools!')") .build(); var request = createRequest(inputFile); @@ -332,8 +325,7 @@ void should_get_answer_from_server_for_css_request() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); bridgeServer.startServer(serverConfig, emptyList()); - DefaultInputFile inputFile = TestInputFileBuilder - .create("foo", "foo.css") + DefaultInputFile inputFile = TestInputFileBuilder.create("foo", "foo.css") .setContents("a { }") .build(); CssAnalysisRequest request = new CssAnalysisRequest( @@ -357,21 +349,26 @@ void should_throw_if_failed_to_start() { @Test void should_return_command_info() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); - assertThat(bridgeServer.getCommandInfo()) - .isEqualTo("Node.js command to start the bridge server was not built yet."); + assertThat(bridgeServer.getCommandInfo()).isEqualTo( + "Node.js command to start the bridge server was not built yet." + ); bridgeServer.startServer(serverConfig, emptyList()); - assertThat(bridgeServer.getCommandInfo()) - .contains("Node.js command to start the bridge server was: ", "node", START_SERVER_SCRIPT); + assertThat(bridgeServer.getCommandInfo()).contains( + "Node.js command to start the bridge server was: ", + "node", + START_SERVER_SCRIPT + ); assertThat(bridgeServer.getCommandInfo()).doesNotContain("--max-old-space-size"); } @Test void should_set_max_old_space_size() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); - assertThat(bridgeServer.getCommandInfo()) - .isEqualTo("Node.js command to start the bridge server was not built yet."); + assertThat(bridgeServer.getCommandInfo()).isEqualTo( + "Node.js command to start the bridge server was not built yet." + ); context.setSettings(new MapSettings().setProperty("sonar.javascript.node.maxspace", 2048)); BridgeServerConfig serverConfigForMaxSpace = BridgeServerConfig.fromSensorContext(context); @@ -475,8 +472,9 @@ void should_throw_special_exception_when_failed_start_server_before() { .isInstanceOf(NodeCommandException.class) .hasMessage(failedToStartExceptionMessage); - assertThatThrownBy(() -> bridgeServer.startServerLazily(serverConfig)) - .isInstanceOf(ServerAlreadyFailedException.class); + assertThatThrownBy(() -> bridgeServer.startServerLazily(serverConfig)).isInstanceOf( + ServerAlreadyFailedException.class + ); } @Test @@ -486,8 +484,9 @@ void should_throw_special_exception_when_failed_start_process_before() { .isInstanceOf(NodeCommandException.class) .hasMessageStartingWith("Node.js script to start the bridge server doesn't exist"); - assertThatThrownBy(() -> bridgeServer.startServerLazily(serverConfig)) - .isInstanceOf(ServerAlreadyFailedException.class); + assertThatThrownBy(() -> bridgeServer.startServerLazily(serverConfig)).isInstanceOf( + ServerAlreadyFailedException.class + ); } @Test @@ -497,8 +496,9 @@ void should_throw_if_server_not_alive() throws Exception { bridgeServer.waitFor(); - assertThatThrownBy(() -> bridgeServer.startServerLazily(serverConfig)) - .isInstanceOf(ServerAlreadyFailedException.class); + assertThatThrownBy(() -> bridgeServer.startServerLazily(serverConfig)).isInstanceOf( + ServerAlreadyFailedException.class + ); } @Test @@ -506,8 +506,7 @@ void should_fail_if_bad_json_response() throws Exception { bridgeServer = createBridgeServer("badResponse.js"); bridgeServer.startServerLazily(serverConfig); - DefaultInputFile inputFile = TestInputFileBuilder - .create("foo", "foo.js") + DefaultInputFile inputFile = TestInputFileBuilder.create("foo", "foo.js") .setContents("alert('Fly, you fools!')") .build(); JsAnalysisRequest request = new JsAnalysisRequest( @@ -522,8 +521,9 @@ void should_fail_if_bad_json_response() throws Exception { false, false ); - assertThatThrownBy(() -> bridgeServer.analyzeJavaScript(request)) - .isInstanceOf(IllegalStateException.class); + assertThatThrownBy(() -> bridgeServer.analyzeJavaScript(request)).isInstanceOf( + IllegalStateException.class + ); assertThat(context.allIssues()).isEmpty(); } @@ -551,12 +551,19 @@ void should_return_files_for_tsconfig() throws Exception { bridgeServer.startServer(serverConfig, emptyList()); String tsconfig = "path/to/tsconfig.json"; BridgeServerImpl.TsConfigResponse tsConfigResponse = bridgeServer.tsConfigFiles(tsconfig); - assertThat(tsConfigResponse.files) - .contains("abs/path/file1", "abs/path/file2", "abs/path/file3"); + assertThat(tsConfigResponse.files).contains( + "abs/path/file1", + "abs/path/file2", + "abs/path/file3" + ); assertThat(tsConfigResponse.error).isNull(); TsConfigFile tsConfigFile = bridgeServer.loadTsConfig(tsconfig); - assertThat(tsConfigFile.getFiles()).contains("abs/path/file1", "abs/path/file2", "abs/path/file3"); + assertThat(tsConfigFile.getFiles()).contains( + "abs/path/file1", + "abs/path/file2", + "abs/path/file3" + ); assertThat(tsConfigFile.getFilename()).isEqualTo(tsconfig); } @@ -614,11 +621,15 @@ void test_rule_tostring() { @Test void should_load_custom_rules() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); - bridgeServer.startServer(serverConfig, Arrays.asList(Paths.get("bundle1"), Paths.get("bundle2"))); + bridgeServer.startServer( + serverConfig, + Arrays.asList(Paths.get("bundle1"), Paths.get("bundle2")) + ); bridgeServer.stop(); - assertThat(logTester.logs()) - .contains("additional rules: [bundle1" + File.pathSeparator + "bundle2]"); + assertThat(logTester.logs()).contains( + "additional rules: [bundle1" + File.pathSeparator + "bundle2]" + ); } @Test @@ -626,7 +637,10 @@ void should_skip_metrics_on_sonarlint() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); context.setRuntime(SonarRuntimeImpl.forSonarLint(Version.create(7, 9))); BridgeServerConfig serverConfigFor79 = BridgeServerConfig.fromSensorContext(context); - bridgeServer.startServer(serverConfigFor79, Arrays.asList(Paths.get("bundle1"), Paths.get("bundle2"))); + bridgeServer.startServer( + serverConfigFor79, + Arrays.asList(Paths.get("bundle1"), Paths.get("bundle2")) + ); bridgeServer.stop(); assertThat(logTester.logs()).contains("sonarlint: true"); @@ -637,7 +651,10 @@ void should_pass_debug_memory_option() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); context.setSettings(new MapSettings().setProperty("sonar.javascript.node.debugMemory", "true")); BridgeServerConfig serverConfigForDebugMemory = BridgeServerConfig.fromSensorContext(context); - bridgeServer.startServer(serverConfigForDebugMemory, Arrays.asList(Paths.get("bundle1"), Paths.get("bundle2"))); + bridgeServer.startServer( + serverConfigForDebugMemory, + Arrays.asList(Paths.get("bundle1"), Paths.get("bundle2")) + ); bridgeServer.stop(); assertThat(logTester.logs()).contains("debugMemory: true"); @@ -645,15 +662,14 @@ void should_pass_debug_memory_option() throws Exception { @Test void should_use_default_timeout() { - bridgeServer = - new BridgeServerImpl( - builder(), - mock(Bundle.class), - mock(RulesBundles.class), - deprecationWarning, - tempFolder, - unsupportedEmbeddedRuntime - ); + bridgeServer = new BridgeServerImpl( + builder(), + mock(Bundle.class), + mock(RulesBundles.class), + deprecationWarning, + tempFolder, + unsupportedEmbeddedRuntime + ); assertThat(bridgeServer.getTimeoutSeconds()).isEqualTo(300); } @@ -681,10 +697,9 @@ void test_tsProgram_toString() { singletonList("path/file.ts"), singletonList("path/tsconfig.json") ); - assertThat(tsProgram) - .hasToString( - "TsProgram{programId='42', files=[path/file.ts], projectReferences=[path/tsconfig.json]}" - ); + assertThat(tsProgram).hasToString( + "TsProgram{programId='42', files=[path/file.ts], projectReferences=[path/tsconfig.json]}" + ); TsProgram tsProgramError = new TsProgram("failed to create program"); assertThat(tsProgramError).hasToString("TsProgram{ error='failed to create program'}"); @@ -692,22 +707,23 @@ void test_tsProgram_toString() { @Test void enabled_monitoring() throws Exception { - bridgeServer = - new BridgeServerImpl( - builder(), - TEST_TIMEOUT_SECONDS, - new TestBundle(START_SERVER_SCRIPT), - emptyRulesBundles, - deprecationWarning, - tempFolder, - unsupportedEmbeddedRuntime - ); + bridgeServer = new BridgeServerImpl( + builder(), + TEST_TIMEOUT_SECONDS, + new TestBundle(START_SERVER_SCRIPT), + emptyRulesBundles, + deprecationWarning, + tempFolder, + unsupportedEmbeddedRuntime + ); bridgeServer.startServerLazily(serverConfig); bridgeServer.stop(); - assertThat(logTester.logs(INFO).stream().anyMatch(s -> s.startsWith("no-commented-code"))) - .isTrue(); - assertThat(logTester.logs(INFO).stream().anyMatch(s -> s.startsWith("arguments-order"))) - .isTrue(); + assertThat( + logTester.logs(INFO).stream().anyMatch(s -> s.startsWith("no-commented-code")) + ).isTrue(); + assertThat( + logTester.logs(INFO).stream().anyMatch(s -> s.startsWith("arguments-order")) + ).isTrue(); assertThat(logTester.logs(INFO).stream().anyMatch(s -> s.startsWith("deprecation"))).isTrue(); } @@ -720,20 +736,20 @@ void test_ucfg_bundle_version() throws Exception { RulesBundles rulesBundles = mock(RulesBundles.class); when(rulesBundles.getUcfgRulesBundle()).thenReturn(Optional.of(ucfgRulesBundle)); - bridgeServer = - new BridgeServerImpl( - builder(), - TEST_TIMEOUT_SECONDS, - new TestBundle(START_SERVER_SCRIPT), - rulesBundles, - deprecationWarning, - tempFolder, - unsupportedEmbeddedRuntime - ); + bridgeServer = new BridgeServerImpl( + builder(), + TEST_TIMEOUT_SECONDS, + new TestBundle(START_SERVER_SCRIPT), + rulesBundles, + deprecationWarning, + tempFolder, + unsupportedEmbeddedRuntime + ); bridgeServer.startServerLazily(serverConfig); - assertThat(logTester.logs(DEBUG)) - .contains("Security Frontend version is available: [some_bundle_version]"); + assertThat(logTester.logs(DEBUG)).contains( + "Security Frontend version is available: [some_bundle_version]" + ); } @Test @@ -741,8 +757,7 @@ void should_return_an_ast() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); bridgeServer.startServer(serverConfig, emptyList()); - DefaultInputFile inputFile = TestInputFileBuilder - .create("foo", "foo.js") + DefaultInputFile inputFile = TestInputFileBuilder.create("foo", "foo.js") .setContents("alert('Fly, you fools!')") .build(); JsAnalysisRequest request = createRequest(inputFile); @@ -758,8 +773,7 @@ void should_omit_an_ast_if_skipAst_flag_is_set() throws Exception { bridgeServer = createBridgeServer(START_SERVER_SCRIPT); bridgeServer.startServer(BridgeServerConfig.fromSensorContext(context), emptyList()); - DefaultInputFile inputFile = TestInputFileBuilder - .create("foo", "foo.js") + DefaultInputFile inputFile = TestInputFileBuilder.create("foo", "foo.js") .setContents("alert('Fly, you fools!')") .build(); JsAnalysisRequest request = new JsAnalysisRequest( @@ -783,14 +797,15 @@ void should_not_deploy_runtime_if_sonar_nodejs_executable_is_set() { var existingDoesntMatterScript = "logging.js"; bridgeServer = createBridgeServer(existingDoesntMatterScript); context.setSettings(new MapSettings().setProperty(NODE_EXECUTABLE_PROPERTY, "whatever")); - BridgeServerConfig serverConfigForExecutableProperty = BridgeServerConfig.fromSensorContext(context); - assertThatThrownBy(() -> bridgeServer.startServerLazily(serverConfigForExecutableProperty)) - .isInstanceOf(NodeCommandException.class); + BridgeServerConfig serverConfigForExecutableProperty = BridgeServerConfig.fromSensorContext( + context + ); + assertThatThrownBy(() -> bridgeServer.startServerLazily(serverConfigForExecutableProperty) + ).isInstanceOf(NodeCommandException.class); - assertThat(logTester.logs(INFO)) - .contains( - "'" + NODE_EXECUTABLE_PROPERTY + "' is set. Skipping embedded Node.js runtime deployment." - ); + assertThat(logTester.logs(INFO)).contains( + "'" + NODE_EXECUTABLE_PROPERTY + "' is set. Skipping embedded Node.js runtime deployment." + ); } @Test @@ -804,10 +819,11 @@ void should_not_deploy_runtime_if_skip_node_provisioning_is_set() throws Excepti var config = BridgeServerConfig.fromSensorContext(context); bridgeServer.startServerLazily(config); - assertThat(logTester.logs(INFO)) - .contains( - "'" + SKIP_NODE_PROVISIONING_PROPERTY + "' is set. Skipping embedded Node.js runtime deployment." - ); + assertThat(logTester.logs(INFO)).contains( + "'" + + SKIP_NODE_PROVISIONING_PROPERTY + + "' is set. Skipping embedded Node.js runtime deployment." + ); } @Test @@ -821,35 +837,38 @@ void should_not_deploy_runtime_if_node_force_host_is_set() throws Exception { var config = BridgeServerConfig.fromSensorContext(context); bridgeServer.startServerLazily(config); - assertThat(logTester.logs(INFO)) - .contains( - "'" + NODE_FORCE_HOST_PROPERTY + "' is set. Skipping embedded Node.js runtime deployment." - ); + assertThat(logTester.logs(INFO)).contains( + "'" + NODE_FORCE_HOST_PROPERTY + "' is set. Skipping embedded Node.js runtime deployment." + ); } @Test void should_start_bridge_from_path() throws IOException { bridgeServer = createBridgeServer(new BundleImpl()); var deployLocation = "src/test/resources"; - var settings = new MapSettings().setProperty(BridgeServerImpl.SONARLINT_BUNDLE_PATH, deployLocation); + var settings = new MapSettings() + .setProperty(BridgeServerImpl.SONARLINT_BUNDLE_PATH, deployLocation); context.setSettings(settings); var config = BridgeServerConfig.fromSensorContext(context); bridgeServer.startServerLazily(config); - assertThat(logTester.logs(DEBUG)) - .contains("Setting deploy location to " + deployLocation.replace("/", File.separator)); + assertThat(logTester.logs(DEBUG)).contains( + "Setting deploy location to " + deployLocation.replace("/", File.separator) + ); } @Test void should_fail_on_bad_bridge_path() { bridgeServer = createBridgeServer(new BundleImpl()); var deployLocation = "src/test"; - var settings = new MapSettings().setProperty(BridgeServerImpl.SONARLINT_BUNDLE_PATH, deployLocation); + var settings = new MapSettings() + .setProperty(BridgeServerImpl.SONARLINT_BUNDLE_PATH, deployLocation); context.setSettings(settings); var config = BridgeServerConfig.fromSensorContext(context); - assertThatThrownBy(() -> bridgeServer.startServerLazily(config)) - .isInstanceOf(NodeCommandException.class); + assertThatThrownBy(() -> bridgeServer.startServerLazily(config)).isInstanceOf( + NodeCommandException.class + ); } private BridgeServerImpl createBridgeServer(Bundle bundle) { @@ -910,7 +929,8 @@ public String resolve(String relativePath) { } private static NodeCommandBuilder builder() { - return new NodeCommandBuilderImpl(new ProcessWrapperImpl()) - .configuration(new MapSettings().asConfig()); + return new NodeCommandBuilderImpl(new ProcessWrapperImpl()).configuration( + new MapSettings().asConfig() + ); } } diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/BundleImplTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/BundleImplTest.java index 85034ca6b22..d5ee3bd4f61 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/BundleImplTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/BundleImplTest.java @@ -54,6 +54,8 @@ void should_save_deploy_location() { BundleImpl bundle = new BundleImpl(); bundle.setDeployLocation(deployLocation); String scriptPath = bundle.startServerScript(); - assertThat(scriptPath).isEqualTo(deployLocation.resolve(BundleImpl.DEFAULT_STARTUP_SCRIPT).toString()); + assertThat(scriptPath).isEqualTo( + deployLocation.resolve(BundleImpl.DEFAULT_STARTUP_SCRIPT).toString() + ); } } diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/ESTreeFactoryTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/ESTreeFactoryTest.java index ba51a7636a6..bcfca86f072 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/ESTreeFactoryTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/ESTreeFactoryTest.java @@ -74,11 +74,14 @@ void should_not_fail_with_unknown_nodes() throws IOException { assertThat(root).isInstanceOf(ESTree.Program.class); ESTree.Program program = (ESTree.Program) root; assertThat(program.body()).hasSize(1); - assertThat(program.body().get(0)).isInstanceOfSatisfying(ESTree.IfStatement.class, ifStatement -> { - assertThat(ifStatement.test()).isInstanceOf(ESTree.UnknownNode.class); - ESTree.UnknownNode unknownNode = (ESTree.UnknownNode)ifStatement.test(); - assertThat(unknownNode.rawType()).isEqualTo("TSAsExpression"); - }); + assertThat(program.body().get(0)).isInstanceOfSatisfying( + ESTree.IfStatement.class, + ifStatement -> { + assertThat(ifStatement.test()).isInstanceOf(ESTree.UnknownNode.class); + ESTree.UnknownNode unknownNode = (ESTree.UnknownNode) ifStatement.test(); + assertThat(unknownNode.rawType()).isEqualTo("TSAsExpression"); + } + ); } @Test @@ -96,35 +99,48 @@ void should_create_nodes_from_serialized_data() throws IOException { ESTree.Program program = (ESTree.Program) root; assertThat(program.body()).hasSize(55); // Assert a few nodes. - assertThat(program.body().get(0)).isInstanceOfSatisfying(ESTree.VariableDeclaration.class, variableDeclaration -> { - assertThat(variableDeclaration.declarations()).hasSize(1); - assertThat(variableDeclaration.kind()).isEqualTo("let"); - ESTree.VariableDeclarator variableDeclarator = variableDeclaration.declarations().get(0); - assertThat(variableDeclarator.id()).isInstanceOf(ESTree.Identifier.class); - assertThat(variableDeclarator.init()).contains(new ESTree.SimpleLiteral( - new ESTree.Location(new ESTree.Position(20, 8), new ESTree.Position(20, 12)), - "", - "null" - ) - ); - }); - assertThat(program.body().get(14)).isInstanceOfSatisfying(ESTree.IfStatement.class, ifStatement -> { - assertThat(ifStatement.test()).isInstanceOf(ESTree.Identifier.class); - assertThat(ifStatement.consequent()).isInstanceOf(ESTree.BlockStatement.class); - assertThat(ifStatement.alternate()).isEmpty(); - }); + assertThat(program.body().get(0)).isInstanceOfSatisfying( + ESTree.VariableDeclaration.class, + variableDeclaration -> { + assertThat(variableDeclaration.declarations()).hasSize(1); + assertThat(variableDeclaration.kind()).isEqualTo("let"); + ESTree.VariableDeclarator variableDeclarator = variableDeclaration.declarations().get(0); + assertThat(variableDeclarator.id()).isInstanceOf(ESTree.Identifier.class); + assertThat(variableDeclarator.init()).contains( + new ESTree.SimpleLiteral( + new ESTree.Location(new ESTree.Position(20, 8), new ESTree.Position(20, 12)), + "", + "null" + ) + ); + } + ); + assertThat(program.body().get(14)).isInstanceOfSatisfying( + ESTree.IfStatement.class, + ifStatement -> { + assertThat(ifStatement.test()).isInstanceOf(ESTree.Identifier.class); + assertThat(ifStatement.consequent()).isInstanceOf(ESTree.BlockStatement.class); + assertThat(ifStatement.alternate()).isEmpty(); + } + ); // Source code: [, , 5] - assertThat(program.body().get(42)).isInstanceOfSatisfying(ESTree.VariableDeclaration.class, declaration -> { - Optional initializer = declaration.declarations().get(0).init(); - assertThat(initializer).isPresent(); - assertThat(initializer.get()).isInstanceOfSatisfying(ESTree.ArrayExpression.class, arrayExpression -> { - assertThat(arrayExpression.elements()).hasSize(3); - assertThat(arrayExpression.elements().get(0)).isEmpty(); - assertThat(arrayExpression.elements().get(1)).isEmpty(); - assertThat(arrayExpression.elements().get(2)).isNotEmpty(); - }); - }); + assertThat(program.body().get(42)).isInstanceOfSatisfying( + ESTree.VariableDeclaration.class, + declaration -> { + Optional initializer = declaration.declarations().get(0).init(); + assertThat(initializer).isPresent(); + assertThat(initializer.get()).isInstanceOfSatisfying( + ESTree.ArrayExpression.class, + arrayExpression -> { + assertThat(arrayExpression.elements()).hasSize(3); + assertThat(arrayExpression.elements().get(0)).isEmpty(); + assertThat(arrayExpression.elements().get(1)).isEmpty(); + assertThat(arrayExpression.elements().get(2)).isNotEmpty(); + } + ); + } + ); } @Test @@ -135,14 +151,13 @@ void should_create_program() { .build(); Node protobufNode = Node.newBuilder() .setType(NodeType.ProgramType) - .setProgram(Program.newBuilder() - .setSourceType("script") - .addBody(body) - .build()) - .setLoc(SourceLocation.newBuilder() - .setStart(Position.newBuilder().setLine(1).setColumn(2).build()) - .setEnd(Position.newBuilder().setLine(3).setColumn(4).build()) - .build()) + .setProgram(Program.newBuilder().setSourceType("script").addBody(body).build()) + .setLoc( + SourceLocation.newBuilder() + .setStart(Position.newBuilder().setLine(1).setColumn(2).build()) + .setEnd(Position.newBuilder().setLine(3).setColumn(4).build()) + .build() + ) .build(); ESTree.Program estreeProgram = ESTreeFactory.from(protobufNode, ESTree.Program.class); @@ -153,15 +168,14 @@ void should_create_program() { assertThat(estreeProgram.loc().end().column()).isEqualTo(4); assertThat(estreeProgram.body()).hasSize(1); ESTree.Node estreeBody = estreeProgram.body().get(0); - assertThat(estreeBody).isInstanceOfSatisfying(ESTree.BlockStatement.class, - blockStatement -> assertThat(blockStatement.body()).isEmpty()); + assertThat(estreeBody).isInstanceOfSatisfying(ESTree.BlockStatement.class, blockStatement -> + assertThat(blockStatement.body()).isEmpty() + ); } @Test void should_create_expression_statement_when_directive_is_empty() { - Node expressionContent = Node.newBuilder() - .setType(NodeType.ThisExpressionType) - .build(); + Node expressionContent = Node.newBuilder().setType(NodeType.ThisExpressionType).build(); ExpressionStatement expressionStatement = ExpressionStatement.newBuilder() .setExpression(expressionContent) .build(); @@ -176,9 +190,7 @@ void should_create_expression_statement_when_directive_is_empty() { @Test void should_create_directive_from_expression_statement() { - Node expressionContent = Node.newBuilder() - .setType(NodeType.LiteralType) - .build(); + Node expressionContent = Node.newBuilder().setType(NodeType.LiteralType).build(); ExpressionStatement expressionStatement = ExpressionStatement.newBuilder() .setDirective("directive") .setExpression(expressionContent) @@ -189,140 +201,123 @@ void should_create_directive_from_expression_statement() { .build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.Directive.class, - directive -> assertThat(directive.directive()).isEqualTo("directive")); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.Directive.class, + directive -> assertThat(directive.directive()).isEqualTo("directive") + ); } @Test void should_create_BigIntLiteral() { - Literal literal = Literal.newBuilder() - .setBigint("1234") - .build(); - Node protobufNode = Node.newBuilder() - .setType(NodeType.LiteralType) - .setLiteral(literal) - .build(); + Literal literal = Literal.newBuilder().setBigint("1234").build(); + Node protobufNode = Node.newBuilder().setType(NodeType.LiteralType).setLiteral(literal).build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.BigIntLiteral.class, bigIntLiteral -> { - assertThat(bigIntLiteral.bigint()).isEqualTo("1234"); - assertThat(bigIntLiteral.value()).isEqualTo(new BigInteger("1234")); - // Default value. - assertThat(bigIntLiteral.raw()).isEmpty(); - }); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.BigIntLiteral.class, + bigIntLiteral -> { + assertThat(bigIntLiteral.bigint()).isEqualTo("1234"); + assertThat(bigIntLiteral.value()).isEqualTo(new BigInteger("1234")); + // Default value. + assertThat(bigIntLiteral.raw()).isEmpty(); + } + ); } @Test void should_create_simple_string_literal() { - Literal literal = Literal.newBuilder() - .setRaw("'raw'") - .setValueString("raw") - .build(); - Node protobufNode = Node.newBuilder() - .setType(NodeType.LiteralType) - .setLiteral(literal) - .build(); + Literal literal = Literal.newBuilder().setRaw("'raw'").setValueString("raw").build(); + Node protobufNode = Node.newBuilder().setType(NodeType.LiteralType).setLiteral(literal).build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.SimpleLiteral.class, simpleLiteral -> { - assertThat(simpleLiteral.raw()).isEqualTo("'raw'"); - assertThat(simpleLiteral.value()).isEqualTo("raw"); - }); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.SimpleLiteral.class, + simpleLiteral -> { + assertThat(simpleLiteral.raw()).isEqualTo("'raw'"); + assertThat(simpleLiteral.value()).isEqualTo("raw"); + } + ); } @Test void should_create_simple_int_literal() { - Literal literal = Literal.newBuilder() - .setRaw("42") - .setValueNumber(42) - .build(); - Node protobufNode = Node.newBuilder() - .setType(NodeType.LiteralType) - .setLiteral(literal) - .build(); + Literal literal = Literal.newBuilder().setRaw("42").setValueNumber(42).build(); + Node protobufNode = Node.newBuilder().setType(NodeType.LiteralType).setLiteral(literal).build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.SimpleLiteral.class, simpleLiteral -> { - assertThat(simpleLiteral.raw()).isEqualTo("42"); - assertThat(simpleLiteral.value()).isEqualTo(42); - }); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.SimpleLiteral.class, + simpleLiteral -> { + assertThat(simpleLiteral.raw()).isEqualTo("42"); + assertThat(simpleLiteral.value()).isEqualTo(42); + } + ); } @Test void should_create_simple_bool_literal() { - Literal literal = Literal.newBuilder() - .setRaw("true") - .setValueBoolean(true) - .build(); - Node protobufNode = Node.newBuilder() - .setType(NodeType.LiteralType) - .setLiteral(literal) - .build(); + Literal literal = Literal.newBuilder().setRaw("true").setValueBoolean(true).build(); + Node protobufNode = Node.newBuilder().setType(NodeType.LiteralType).setLiteral(literal).build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.SimpleLiteral.class, simpleLiteral -> { - assertThat(simpleLiteral.raw()).isEqualTo("true"); - assertThat(simpleLiteral.value()).isEqualTo(true); - }); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.SimpleLiteral.class, + simpleLiteral -> { + assertThat(simpleLiteral.raw()).isEqualTo("true"); + assertThat(simpleLiteral.value()).isEqualTo(true); + } + ); } - @Test void should_create_reg_exp_literal() { - Literal literal = Literal.newBuilder() - .setPattern("1234") - .build(); - Node protobufNode = Node.newBuilder() - .setType(NodeType.LiteralType) - .setLiteral(literal) - .build(); + Literal literal = Literal.newBuilder().setPattern("1234").build(); + Node protobufNode = Node.newBuilder().setType(NodeType.LiteralType).setLiteral(literal).build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.RegExpLiteral.class, regExpLiteral -> { - assertThat(regExpLiteral.pattern()).isEqualTo("1234"); - assertThat(regExpLiteral.flags()).isEmpty(); - // Default value. - assertThat(regExpLiteral.raw()).isEmpty(); - }); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.RegExpLiteral.class, + regExpLiteral -> { + assertThat(regExpLiteral.pattern()).isEqualTo("1234"); + assertThat(regExpLiteral.flags()).isEmpty(); + // Default value. + assertThat(regExpLiteral.raw()).isEmpty(); + } + ); } @Test void should_create_reg_exp_literal_with_flag() { - Literal literal = Literal.newBuilder() - .setPattern("1234") - .setFlags("flag") - .build(); - Node protobufNode = Node.newBuilder() - .setType(NodeType.LiteralType) - .setLiteral(literal) - .build(); + Literal literal = Literal.newBuilder().setPattern("1234").setFlags("flag").build(); + Node protobufNode = Node.newBuilder().setType(NodeType.LiteralType).setLiteral(literal).build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.RegExpLiteral.class, regExpLiteral -> { - assertThat(regExpLiteral.pattern()).isEqualTo("1234"); - assertThat(regExpLiteral.flags()).isEqualTo("flag"); - // Default value. - assertThat(regExpLiteral.raw()).isEmpty(); - }); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.RegExpLiteral.class, + regExpLiteral -> { + assertThat(regExpLiteral.pattern()).isEqualTo("1234"); + assertThat(regExpLiteral.flags()).isEqualTo("flag"); + // Default value. + assertThat(regExpLiteral.raw()).isEmpty(); + } + ); } @Test void should_create_simple_null_literal() { // Null literal is represented as a raw value "null" in protobuf. // The field "value" will not be set, resulting in an empty string. - Literal literal = Literal.newBuilder() - .setRaw("null") - .build(); - Node protobufNode = Node.newBuilder() - .setType(NodeType.LiteralType) - .setLiteral(literal) - .build(); + Literal literal = Literal.newBuilder().setRaw("null").build(); + Node protobufNode = Node.newBuilder().setType(NodeType.LiteralType).setLiteral(literal).build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.SimpleLiteral.class, simpleLiteral -> { - assertThat(simpleLiteral.raw()).isEqualTo("null"); - assertThat(simpleLiteral.value()).isEqualTo(""); - }); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.SimpleLiteral.class, + simpleLiteral -> { + assertThat(simpleLiteral.raw()).isEqualTo("null"); + assertThat(simpleLiteral.value()).isEqualTo(""); + } + ); } @Test @@ -336,10 +331,13 @@ void should_create_simple_call_expression() { .build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.CallExpression.class, estreeCallExpression -> { - assertThat(estreeCallExpression.callee()).isInstanceOf(ESTree.Super.class); - assertThat(estreeCallExpression.arguments()).isEmpty(); - }); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.CallExpression.class, + estreeCallExpression -> { + assertThat(estreeCallExpression.callee()).isInstanceOf(ESTree.Super.class); + assertThat(estreeCallExpression.arguments()).isEmpty(); + } + ); } @Test @@ -382,7 +380,6 @@ void should_create_unary_expression() { }); } - @Test void should_create_logical_expression() { LogicalExpression logicalExpression = LogicalExpression.newBuilder() @@ -419,7 +416,9 @@ void should_create_assignment_expression() { assertThat(estree).isInstanceOfSatisfying(ESTree.AssignmentExpression.class, logical -> { assertThat(logical.left()).isInstanceOf(ESTree.ArrayPattern.class); assertThat(logical.right()).isInstanceOf(ESTree.ThisExpression.class); - assertThat(logical.operator()).isEqualTo(ESTree.AssignmentOperator.UNSIGNED_RIGHT_SHIFT_ASSIGN); + assertThat(logical.operator()).isEqualTo( + ESTree.AssignmentOperator.UNSIGNED_RIGHT_SHIFT_ASSIGN + ); }); } @@ -496,7 +495,9 @@ void should_create_import_expression() { .build(); ESTree.Node estree = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estree).isInstanceOfSatisfying(ESTree.ImportExpression.class, expression -> assertThat(expression.source()).isInstanceOf(ESTree.ThisExpression.class)); + assertThat(estree).isInstanceOfSatisfying(ESTree.ImportExpression.class, expression -> + assertThat(expression.source()).isInstanceOf(ESTree.ThisExpression.class) + ); } @Test @@ -622,19 +623,13 @@ void should_create_export_all_declaration_type_using_a_literal() { .setExported( Node.newBuilder() .setType(NodeType.LiteralType) - .setLiteral( - Literal.newBuilder() - .setValueString("4k") - ) + .setLiteral(Literal.newBuilder().setValueString("4k")) .build() ) .setSource( Node.newBuilder() .setType(NodeType.LiteralType) - .setLiteral( - Literal.newBuilder() - .setValueString("yolo") - ) + .setLiteral(Literal.newBuilder().setValueString("yolo")) ) .build(); @@ -654,13 +649,17 @@ void should_create_export_all_declaration_type_using_a_literal() { @Test void directive_can_be_in_block_statement() { BlockStatement blockStatement = BlockStatement.newBuilder() - .addBody(Node.newBuilder() - .setType(NodeType.ExpressionStatementType) - .setExpressionStatement(ExpressionStatement.newBuilder() - .setDirective("directiveName") - .setExpression(Node.newBuilder().setType(NodeType.LiteralType).build()) - .build()) - .build()) + .addBody( + Node.newBuilder() + .setType(NodeType.ExpressionStatementType) + .setExpressionStatement( + ExpressionStatement.newBuilder() + .setDirective("directiveName") + .setExpression(Node.newBuilder().setType(NodeType.LiteralType).build()) + .build() + ) + .build() + ) .build(); Node protobufNode = Node.newBuilder() .setType(NodeType.BlockStatementType) @@ -680,11 +679,17 @@ void directive_can_be_in_block_statement() { void array_expression_can_contain_empty_elements() { Node protobufNode = Node.newBuilder() .setType(NodeType.ArrayExpressionType) - .setArrayExpression(ArrayExpression.newBuilder() - .addElements(ArrayElement.newBuilder().build()) - .addElements(ArrayElement.newBuilder().setElement(Node.newBuilder().setType(NodeType.ThisExpressionType).build()).build()) - .addElements(ArrayElement.newBuilder().build()) - .build()) + .setArrayExpression( + ArrayExpression.newBuilder() + .addElements(ArrayElement.newBuilder().build()) + .addElements( + ArrayElement.newBuilder() + .setElement(Node.newBuilder().setType(NodeType.ThisExpressionType).build()) + .build() + ) + .addElements(ArrayElement.newBuilder().build()) + .build() + ) .build(); ESTree.Node estree = ESTreeFactory.from(protobufNode, ESTree.Node.class); @@ -700,11 +705,17 @@ void array_expression_can_contain_empty_elements() { void array_pattern_can_contain_empty_elements() { Node protobufNode = Node.newBuilder() .setType(NodeType.ArrayPatternType) - .setArrayPattern(ArrayPattern.newBuilder() - .addElements(ArrayElement.newBuilder().build()) - .addElements(ArrayElement.newBuilder().setElement(Node.newBuilder().setType(NodeType.IdentifierType).build()).build()) - .addElements(ArrayElement.newBuilder().build()) - .build()) + .setArrayPattern( + ArrayPattern.newBuilder() + .addElements(ArrayElement.newBuilder().build()) + .addElements( + ArrayElement.newBuilder() + .setElement(Node.newBuilder().setType(NodeType.IdentifierType).build()) + .build() + ) + .addElements(ArrayElement.newBuilder().build()) + .build() + ) .build(); ESTree.Node estree = ESTreeFactory.from(protobufNode, ESTree.Node.class); @@ -726,25 +737,24 @@ void should_create_export_assignment() { .setCallExpression(callExpression) .build(); // - ExportAssignment exportAssignment = ExportAssignment.newBuilder() - .setExpression(node) - .build(); + ExportAssignment exportAssignment = ExportAssignment.newBuilder().setExpression(node).build(); Node protobufNode = Node.newBuilder() .setType(NodeType.ExportAssignmentType) .setExportAssignment(exportAssignment) .build(); ESTree.Node estreeExpressionStatement = ESTreeFactory.from(protobufNode, ESTree.Node.class); - assertThat(estreeExpressionStatement).isInstanceOfSatisfying(ESTree.ExportAssignment.class, export -> { - assertThat(export.expression()).isInstanceOf(ESTree.CallExpression.class); - }); + assertThat(estreeExpressionStatement).isInstanceOfSatisfying( + ESTree.ExportAssignment.class, + export -> { + assertThat(export.expression()).isInstanceOf(ESTree.CallExpression.class); + } + ); } @Test void throw_exception_from_unrecognized_type() { - Node protobufNode = Node.newBuilder() - .setTypeValue(-1) - .build(); + Node protobufNode = Node.newBuilder().setTypeValue(-1).build(); assertThatThrownBy(() -> ESTreeFactory.from(protobufNode, ESTree.Node.class)) .isInstanceOf(IllegalArgumentException.class) @@ -760,7 +770,9 @@ void throw_exception_for_incorrect_cast() { assertThatThrownBy(() -> ESTreeFactory.from(block, ESTree.Super.class)) .isInstanceOf(IllegalStateException.class) - .hasMessage("Expected class org.sonar.plugins.javascript.api.estree.ESTree$Super " + - "but got class org.sonar.plugins.javascript.api.estree.ESTree$BlockStatement"); + .hasMessage( + "Expected class org.sonar.plugins.javascript.api.estree.ESTree$Super " + + "but got class org.sonar.plugins.javascript.api.estree.ESTree$BlockStatement" + ); } } diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/EmbeddedNodeTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/EmbeddedNodeTest.java index e4d629b0dca..e4e696cf307 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/EmbeddedNodeTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/EmbeddedNodeTest.java @@ -164,27 +164,29 @@ void should_log_if_platform_unsupported() throws Exception { logTester.setLevel(Level.DEBUG); var en = new EmbeddedNode(mock(ProcessWrapper.class), createUnsupportedEnvironment()); en.deploy(); - assertThat(logTester.logs()) - .anyMatch(l -> - l.startsWith( - "Your platform is not supported for embedded Node.js. Falling back to host Node.js." - ) - ); + assertThat(logTester.logs()).anyMatch(l -> + l.startsWith( + "Your platform is not supported for embedded Node.js. Falling back to host Node.js." + ) + ); } @Test void should_fail_gracefully() throws Exception { ProcessWrapper processWrapper = mock(ProcessWrapper.class); - when(processWrapper.waitFor(any(), anyLong(), any())) - .thenThrow(new IllegalStateException("My Error")); + when(processWrapper.waitFor(any(), anyLong(), any())).thenThrow( + new IllegalStateException("My Error") + ); var en = new EmbeddedNode(processWrapper, createTestEnvironment()); en.deploy(); - assertThat(logTester.logs()) - .anyMatch(l -> + assertThat(logTester.logs()).anyMatch( + l -> l.startsWith("Embedded Node.js failed to deploy in ") && - l.contains("You can change the location by setting the option `sonar.userHome` or the environment variable `SONAR_USER_HOME`.") && - l.endsWith("Will fallback to host Node.js.") - ); + l.contains( + "You can change the location by setting the option `sonar.userHome` or the environment variable `SONAR_USER_HOME`." + ) && + l.endsWith("Will fallback to host Node.js.") + ); } @Nonnull diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/EslintRuleTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/EslintRuleTest.java index 06e04a0f464..10f4c9f94a7 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/EslintRuleTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/EslintRuleTest.java @@ -43,9 +43,8 @@ void should_convert_to_string() { @Test void should_throw_when_invalid_lang() { assertThatThrownBy(() -> - new EslintRule("key", List.of(), List.of(InputFile.Type.MAIN), "invalid") - ) - .isInstanceOf(IllegalArgumentException.class); + new EslintRule("key", List.of(), List.of(InputFile.Type.MAIN), "invalid") + ).isInstanceOf(IllegalArgumentException.class); } @Test @@ -56,8 +55,7 @@ void getters() { } private static List rules(String... keys) { - return Arrays - .stream(keys) + return Arrays.stream(keys) .map(key -> new EslintRule(key, emptyList(), emptyList(), "js")) .toList(); } diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/FormDataUtilsTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/FormDataUtilsTest.java index 01af9f0ed60..09658bdedb1 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/FormDataUtilsTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/FormDataUtilsTest.java @@ -39,7 +39,8 @@ public class FormDataUtilsTest { @Test void should_parse_form_data_into_bridge_response() throws Exception { - var contentTypeHeader = "multipart/form-data; boundary=---------------------------9051914041544843365972754266"; + var contentTypeHeader = + "multipart/form-data; boundary=---------------------------9051914041544843365972754266"; var body = buildPayload("{\"hello\":\"worlds\"}"); BridgeServer.BridgeResponse response = parseFormData(contentTypeHeader, body); @@ -57,7 +58,7 @@ private static byte[] getSerializedProtoData() throws IOException { } private static byte[] concatArrays(byte[] arr1, byte[] arr2, byte[] arr3) throws IOException { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); outputStream.write(arr1); outputStream.write(arr2); outputStream.write(arr3); @@ -68,8 +69,10 @@ private static byte[] buildPayload(String jsonData) throws IOException { return buildPayload(jsonData, null); } - private static byte[] buildPayload(String jsonData, @Nullable byte[] protoData) throws IOException { - var firstPart = "-----------------------------9051914041544843365972754266" + + private static byte[] buildPayload(String jsonData, @Nullable byte[] protoData) + throws IOException { + var firstPart = + "-----------------------------9051914041544843365972754266" + "\r\n" + "Content-Disposition: form-data; name=\"json\"" + "\r\n" + @@ -82,9 +85,7 @@ private static byte[] buildPayload(String jsonData, @Nullable byte[] protoData) "\r\n" + "\r\n"; protoData = protoData != null ? protoData : getSerializedProtoData(); - var lastPart = "\r\n" + - "-----------------------------9051914041544843365972754266--" + - "\r\n"; + var lastPart = "\r\n" + "-----------------------------9051914041544843365972754266--" + "\r\n"; return concatArrays( firstPart.getBytes(StandardCharsets.UTF_8), protoData, @@ -94,20 +95,24 @@ private static byte[] buildPayload(String jsonData, @Nullable byte[] protoData) @Test void should_log_error_if_ast_is_invalid() throws Exception { - var contentTypeHeader = "multipart/form-data; boundary=---------------------------9051914041544843365972754266"; - var invalidAst = new byte[]{42}; + var contentTypeHeader = + "multipart/form-data; boundary=---------------------------9051914041544843365972754266"; + var invalidAst = new byte[] { 42 }; var body = buildPayload("{\"hello\":\"worlds\"}", invalidAst); assertThat(parseFormData(contentTypeHeader, body).ast()).isNull(); assertThat(logTester.logs(Level.ERROR)).containsExactly( "Failed to deserialize Protobuf message: While parsing a protocol message, the input ended unexpectedly in the middle of a field. " + - "This could mean either that the input has been truncated or that an embedded message misreported its own length."); + "This could mean either that the input has been truncated or that an embedded message misreported its own length." + ); } @Test void should_throw_an_error_if_json_is_missing() throws Exception { - var contentTypeHeader = "multipart/form-data; boundary=---------------------------9051914041544843365972754266"; - var body = "-----------------------------9051914041544843365972754266" + + var contentTypeHeader = + "multipart/form-data; boundary=---------------------------9051914041544843365972754266"; + var body = + "-----------------------------9051914041544843365972754266" + "\r\n" + "Content-Disposition: form-data; name=\"ast\"" + "\r\n" + @@ -117,15 +122,18 @@ void should_throw_an_error_if_json_is_missing() throws Exception { "-----------------------------9051914041544843365972754266--" + "\r\n"; - assertThatThrownBy(() -> parseFormData(contentTypeHeader, body.getBytes(StandardCharsets.UTF_8))) + assertThatThrownBy(() -> parseFormData(contentTypeHeader, body.getBytes(StandardCharsets.UTF_8)) + ) .isInstanceOf(IllegalStateException.class) .hasMessage("Data missing from response"); } @Test void should_throw_an_error_if_ast_is_missing() throws Exception { - var contentTypeHeader = "multipart/form-data; boundary=---------------------------9051914041544843365972754266"; - var body = "-----------------------------9051914041544843365972754266" + + var contentTypeHeader = + "multipart/form-data; boundary=---------------------------9051914041544843365972754266"; + var body = + "-----------------------------9051914041544843365972754266" + "\r\n" + "Content-Disposition: form-data; name=\"json\"" + "\r\n" + @@ -134,7 +142,8 @@ void should_throw_an_error_if_ast_is_missing() throws Exception { "\r\n" + "-----------------------------9051914041544843365972754266--" + "\r\n"; - assertThatThrownBy(() -> parseFormData(contentTypeHeader, body.getBytes(StandardCharsets.UTF_8))) + assertThatThrownBy(() -> parseFormData(contentTypeHeader, body.getBytes(StandardCharsets.UTF_8)) + ) .isInstanceOf(IllegalStateException.class) .hasMessage("Data missing from response"); } diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/NodeDeprecationWarningTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/NodeDeprecationWarningTest.java index 9ca2b7016b3..a6f84b8d359 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/NodeDeprecationWarningTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/NodeDeprecationWarningTest.java @@ -48,7 +48,8 @@ void test_unsupported() { deprecationWarning.logNodeDeprecation(16); assertWarnings( "Using Node.js version 16 to execute analysis is not supported. " + - "Please upgrade to a newer LTS version of Node.js: [^20.9.0, ^22.9.0]."); + "Please upgrade to a newer LTS version of Node.js: [^20.9.0, ^22.9.0]." + ); } @Test @@ -57,8 +58,10 @@ void test_supported() { deprecationWarning.logNodeDeprecation(20); deprecationWarning.logNodeDeprecation(21); deprecationWarning.logNodeDeprecation(22); - assertWarnings("Using Node.js version 18 to execute analysis is not supported. " + - "Please upgrade to a newer LTS version of Node.js: [^20.9.0, ^22.9.0]."); + assertWarnings( + "Using Node.js version 18 to execute analysis is not supported. " + + "Please upgrade to a newer LTS version of Node.js: [^20.9.0, ^22.9.0]." + ); } private void assertWarnings(String... messages) { diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/PluginInfoTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/PluginInfoTest.java index 4d73fef2c8c..2a64bae21b5 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/PluginInfoTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/PluginInfoTest.java @@ -30,5 +30,4 @@ void test() { PluginInfo.setUcfgPluginVersion("1.0.0"); assertEquals("1.0.0", PluginInfo.getUcfgPluginVersion().get()); } - } diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/RulesBundlesTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/RulesBundlesTest.java index c82bb8c6589..d50b3b7058a 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/RulesBundlesTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/bridge/RulesBundlesTest.java @@ -38,8 +38,9 @@ class RulesBundlesTest { @Test void test_not_exists() { RulesBundle[] missingBundle = { new TestRulesBundle("missing.tgz") }; - assertThatThrownBy(() -> new RulesBundles(missingBundle)) - .isInstanceOf(IllegalStateException.class); + assertThatThrownBy(() -> new RulesBundles(missingBundle)).isInstanceOf( + IllegalStateException.class + ); } @Test @@ -55,8 +56,7 @@ void test_deploy_should_log_deployment_in_debug() { RulesBundles rulesBundles = new RulesBundles(new TestRulesBundle[] { rulesBundle }); rulesBundles.deploy(tempDir); assertThat(logTester.logs(Level.DEBUG)).hasSize(1); - assertThat(logTester.logs(Level.DEBUG).get(0)) - .startsWith("Deploying custom rules bundle"); + assertThat(logTester.logs(Level.DEBUG).get(0)).startsWith("Deploying custom rules bundle"); assertThat(logTester.logs(Level.DEBUG).get(0)).contains(filename); } diff --git a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/nodejs/NodeCommandTest.java b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/nodejs/NodeCommandTest.java index 969361371aa..5eab923b69a 100644 --- a/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/nodejs/NodeCommandTest.java +++ b/sonar-plugin/bridge/src/test/java/org/sonar/plugins/javascript/nodejs/NodeCommandTest.java @@ -72,8 +72,9 @@ class NodeCommandTest { @BeforeEach public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - when(mockProcessWrapper.startProcess(any(), any(), any(), any())) - .thenReturn(mock(Process.class)); + when(mockProcessWrapper.startProcess(any(), any(), any(), any())).thenReturn( + mock(Process.class) + ); } @Test @@ -107,8 +108,8 @@ void test_output_error_consumer() throws Exception { @Test void test_min_version() throws IOException { assertThatThrownBy(() -> - builder().minNodeVersion(Version.create(99, 0)).pathResolver(getPathResolver()).build() - ) + builder().minNodeVersion(Version.create(99, 0)).pathResolver(getPathResolver()).build() + ) .isInstanceOf(NodeCommandException.class) .hasMessageMatching( "Unsupported Node.JS version detected .* Please upgrade to the latest Node.JS LTS version." @@ -120,8 +121,8 @@ void test_mac_default_executable_not_found() throws IOException { when(mockProcessWrapper.isMac()).thenReturn(true); assertThatThrownBy(() -> - builder(mockProcessWrapper).pathResolver(p -> "/file/does/not/exist").build() - ) + builder(mockProcessWrapper).pathResolver(p -> "/file/does/not/exist").build() + ) .isInstanceOf(NodeCommandException.class) .hasMessage("Default Node.js executable for MacOS does not exist."); } @@ -143,8 +144,9 @@ void test_min_version_positive() throws Exception { void test_version_check() { assertThat(NodeCommandBuilderImpl.nodeVersion("v5.1.1")).isEqualTo(Version.create(5, 1, 1)); assertThat(NodeCommandBuilderImpl.nodeVersion("v10.8.0")).isEqualTo(Version.create(10, 8, 0)); - assertThat(NodeCommandBuilderImpl.nodeVersion("v10.8.0+123")) - .isEqualTo(Version.create(10, 8, 0)); + assertThat(NodeCommandBuilderImpl.nodeVersion("v10.8.0+123")).isEqualTo( + Version.create(10, 8, 0) + ); assertThatThrownBy(() -> NodeCommandBuilderImpl.nodeVersion("Invalid version")) .isInstanceOf(NodeCommandException.class) @@ -166,8 +168,9 @@ void test_max_old_space_size_setting() throws IOException { command.waitFor(); Map map = new Gson().fromJson(output.toString(), Map.class); double total_available_size = (double) map.get("total_available_size"); - assertThat(logTester.logs(Level.INFO)) - .contains("Configured Node.js --max-old-space-size=" + maxOldSpaceSize + "."); + assertThat(logTester.logs(Level.INFO)).contains( + "Configured Node.js --max-old-space-size=" + maxOldSpaceSize + "." + ); assertThat(total_available_size).isGreaterThan(maxOldSpaceSize * 1000); } @@ -261,8 +264,9 @@ void test_interrupted_waitFor() throws Exception { nodeCommand.start(); int exitValue = nodeCommand.waitFor(); verify(mockProcessWrapper).interrupt(); - assertThat(logTester.logs()) - .contains("Interrupted while waiting for Node.js process to terminate."); + assertThat(logTester.logs()).contains( + "Interrupted while waiting for Node.js process to terminate." + ); assertThat(exitValue).isEqualTo(1); } @@ -339,8 +343,9 @@ void test_command_on_mac() throws Exception { @Test void test_missing_node() throws Exception { - when(mockProcessWrapper.startProcess(any(), any(), any(), any())) - .thenThrow(new IOException("CreateProcess error=2")); + when(mockProcessWrapper.startProcess(any(), any(), any(), any())).thenThrow( + new IOException("CreateProcess error=2") + ); NodeCommand nodeCommand = builder(mockProcessWrapper) .configuration(new MapSettings().asConfig()) .script("not-used") @@ -369,30 +374,38 @@ void test_actual_node_version() throws Exception { @Test void test_windows_default_node() throws Exception { when(mockProcessWrapper.isWindows()).thenReturn(true); - when(mockProcessWrapper.startProcess(processStartArgument.capture(), any(), any(), any())) - .then(invocation -> { + when(mockProcessWrapper.startProcess(processStartArgument.capture(), any(), any(), any())).then( + invocation -> { invocation.getArgument(2, Consumer.class).accept("C:\\Program Files\\node.exe"); return mock(Process.class); - }); + } + ); NodeCommand nodeCommand = builder(mockProcessWrapper).script("script.js").build(); - assertThat(processStartArgument.getValue()) - .containsExactly("C:\\Windows\\System32\\where.exe", "$PATH:node.exe"); + assertThat(processStartArgument.getValue()).containsExactly( + "C:\\Windows\\System32\\where.exe", + "$PATH:node.exe" + ); nodeCommand.start(); - assertThat(processStartArgument.getValue()) - .containsExactly("C:\\Program Files\\node.exe", "script.js"); + assertThat(processStartArgument.getValue()).containsExactly( + "C:\\Program Files\\node.exe", + "script.js" + ); } @Test void test_windows_default_node_not_found() throws Exception { when(mockProcessWrapper.isWindows()).thenReturn(true); - when(mockProcessWrapper.startProcess(processStartArgument.capture(), any(), any(), any())) - .thenReturn(mock(Process.class)); + when( + mockProcessWrapper.startProcess(processStartArgument.capture(), any(), any(), any()) + ).thenReturn(mock(Process.class)); NodeCommandBuilder builder = builder(mockProcessWrapper).script("script.js"); assertThatThrownBy(builder::build) .isInstanceOf(NodeCommandException.class) .hasMessage("Node.js not found in PATH. PATH value was: null"); - assertThat(processStartArgument.getValue()) - .containsExactly("C:\\Windows\\System32\\where.exe", "$PATH:node.exe"); + assertThat(processStartArgument.getValue()).containsExactly( + "C:\\Windows\\System32\\where.exe", + "$PATH:node.exe" + ); } @Test @@ -429,8 +442,7 @@ void test_embedded_runtime_with_forceHost_for_macos() throws Exception { .embeddedNode(en) .build(); var commandParts = nodeCommand.toString().split(" "); - assertThat(commandParts[0]) - .endsWith("src/test/resources/package/bin/run-node"); + assertThat(commandParts[0]).endsWith("src/test/resources/package/bin/run-node"); } @Test @@ -462,11 +474,10 @@ void test_node_force_host_property_deprecation() throws Exception { .pathResolver(getPathResolver()) .build(); - assertThat(logTester.logs(Level.WARN)) - .contains( - "Property 'sonar.nodejs.forceHost' is deprecated and will be removed in a future version. " + - "Please use 'sonar.scanner.skipNodeProvisioning' instead." - ); + assertThat(logTester.logs(Level.WARN)).contains( + "Property 'sonar.nodejs.forceHost' is deprecated and will be removed in a future version. " + + "Please use 'sonar.scanner.skipNodeProvisioning' instead." + ); } private static String resourceScript(String script) throws URISyntaxException { diff --git a/sonar-plugin/css/src/main/java/org/sonar/css/StylelintReportSensor.java b/sonar-plugin/css/src/main/java/org/sonar/css/StylelintReportSensor.java index 5b1d123b6f6..da66155e520 100644 --- a/sonar-plugin/css/src/main/java/org/sonar/css/StylelintReportSensor.java +++ b/sonar-plugin/css/src/main/java/org/sonar/css/StylelintReportSensor.java @@ -16,6 +16,8 @@ */ package org.sonar.css; +import static org.sonar.css.CssRulesDefinition.RESOURCE_FOLDER; + import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; import java.io.File; @@ -42,8 +44,6 @@ import org.sonarsource.analyzer.commons.ExternalReportProvider; import org.sonarsource.analyzer.commons.ExternalRuleLoader; -import static org.sonar.css.CssRulesDefinition.RESOURCE_FOLDER; - public class StylelintReportSensor implements Sensor { public static final String STYLELINT = "stylelint"; diff --git a/sonar-plugin/css/src/main/java/org/sonar/css/metrics/CssLexer.java b/sonar-plugin/css/src/main/java/org/sonar/css/metrics/CssLexer.java index f7904197fa4..fcc7980c9cd 100644 --- a/sonar-plugin/css/src/main/java/org/sonar/css/metrics/CssLexer.java +++ b/sonar-plugin/css/src/main/java/org/sonar/css/metrics/CssLexer.java @@ -61,8 +61,7 @@ public final class CssLexer { private CssLexer() {} public static Lexer create() { - return Lexer - .builder() + return Lexer.builder() .withFailIfNoChannelToConsumeOneCharacter(false) .withChannel(regexp(CssTokenType.COMMENT, MULTI_LINE_COMMENT)) .withChannel(regexp(CssTokenType.COMMENT, INLINE_COMMENT)) diff --git a/sonar-plugin/css/src/main/java/org/sonar/css/rules/SelectorTypeNoUnknown.java b/sonar-plugin/css/src/main/java/org/sonar/css/rules/SelectorTypeNoUnknown.java index 3cff3521e7f..808d4538ac6 100644 --- a/sonar-plugin/css/src/main/java/org/sonar/css/rules/SelectorTypeNoUnknown.java +++ b/sonar-plugin/css/src/main/java/org/sonar/css/rules/SelectorTypeNoUnknown.java @@ -41,10 +41,10 @@ public class SelectorTypeNoUnknown implements CssRule { @RuleProperty( key = "ignore", description = """ - Comma-separated list of ignored elements. The possible values are: - "custom-elements": Allow custom elements (e.g "x-foo"). - "default-namespace": Allow unknown type selectors if they belong to the default namespace. - """, + Comma-separated list of ignored elements. The possible values are: + "custom-elements": Allow custom elements (e.g "x-foo"). + "default-namespace": Allow unknown type selectors if they belong to the default namespace. + """, defaultValue = "" + DEFAULT_IGNORE ) String ignore = DEFAULT_IGNORE; diff --git a/sonar-plugin/css/src/test/java/org/sonar/css/CssRulesDefinitionTest.java b/sonar-plugin/css/src/test/java/org/sonar/css/CssRulesDefinitionTest.java index 5645aa319ac..cf5155dff4e 100644 --- a/sonar-plugin/css/src/test/java/org/sonar/css/CssRulesDefinitionTest.java +++ b/sonar-plugin/css/src/test/java/org/sonar/css/CssRulesDefinitionTest.java @@ -82,8 +82,9 @@ private void assertParameterProperties(Repository repository) { Param param = repository.rule("S4662").param("ignoreAtRules"); assertThat(param).isNotNull(); assertThat(param.defaultValue()).startsWith("value,at-root,content"); - assertThat(param.description()) - .isEqualTo("Comma-separated list of \"at-rules\" to consider as valid."); + assertThat(param.description()).isEqualTo( + "Comma-separated list of \"at-rules\" to consider as valid." + ); assertThat(param.type()).isEqualTo(RuleParamType.STRING); } diff --git a/sonar-plugin/css/src/test/java/org/sonar/css/StylelintReportSensorTest.java b/sonar-plugin/css/src/test/java/org/sonar/css/StylelintReportSensorTest.java index affbe5d74ac..cc64637f0b8 100644 --- a/sonar-plugin/css/src/test/java/org/sonar/css/StylelintReportSensorTest.java +++ b/sonar-plugin/css/src/test/java/org/sonar/css/StylelintReportSensorTest.java @@ -54,8 +54,9 @@ class StylelintReportSensorTest { @RegisterExtension public LogTesterJUnit5 logTester = new LogTesterJUnit5().setLevel(Level.DEBUG); - private static final File BASE_DIR = new File("src/test/resources/stylelint-report/") - .getAbsoluteFile(); + private static final File BASE_DIR = new File( + "src/test/resources/stylelint-report/" + ).getAbsoluteFile(); private static final String CONTENT = ".foo {\n}"; private SensorContextTester context = SensorContextTester.create(BASE_DIR); @@ -91,8 +92,9 @@ void should_add_issues_from_report() { assertThat(first.remediationEffort()).isEqualTo(5); assertThat(first.severity()).isEqualTo(Severity.MAJOR); - assertThat(first.primaryLocation().message()) - .isEqualTo("external issue message (color-no-invalid-hex)"); + assertThat(first.primaryLocation().message()).isEqualTo( + "external issue message (color-no-invalid-hex)" + ); assertThat(first.primaryLocation().textRange().start().line()).isEqualTo(1); } @@ -148,8 +150,9 @@ void should_ignore_report_on_older_sonarqube() throws Exception { stylelintReportSensor.execute(context); assertThat(context.allExternalIssues()).isEmpty(); - assertThat(logTester.logs(Level.ERROR)) - .contains("Import of external issues requires SonarQube 7.2 or greater."); + assertThat(logTester.logs(Level.ERROR)).contains( + "Import of external issues requires SonarQube 7.2 or greater." + ); } @Test @@ -166,8 +169,9 @@ void should_log_when_not_existing_report_file() throws Exception { stylelintReportSensor.execute(context); assertThat(context.allExternalIssues()).isEmpty(); - assertThat(logTester.logs(Level.ERROR)) - .contains("No issues information will be saved as the report file can't be read."); + assertThat(logTester.logs(Level.ERROR)).contains( + "No issues information will be saved as the report file can't be read." + ); } @Test @@ -176,10 +180,9 @@ void should_log_when_not_found_input_file() throws Exception { stylelintReportSensor.execute(context); assertThat(context.allExternalIssues()).hasSize(1); - assertThat(logTester.logs(Level.WARN)) - .contains( - "No input file found for not-exist.css. No stylelint issues will be imported on this file." - ); + assertThat(logTester.logs(Level.WARN)).contains( + "No input file found for not-exist.css. No stylelint issues will be imported on this file." + ); } @Test diff --git a/sonar-plugin/css/src/test/java/org/sonar/css/TestActiveRules.java b/sonar-plugin/css/src/test/java/org/sonar/css/TestActiveRules.java index b1e72271c35..419526d286e 100644 --- a/sonar-plugin/css/src/test/java/org/sonar/css/TestActiveRules.java +++ b/sonar-plugin/css/src/test/java/org/sonar/css/TestActiveRules.java @@ -34,8 +34,9 @@ public class TestActiveRules implements ActiveRules { private final List activeRules; public TestActiveRules(String... activeRules) { - this.activeRules = - Arrays.stream(activeRules).map(TestActiveRule::new).collect(Collectors.toList()); + this.activeRules = Arrays.stream(activeRules) + .map(TestActiveRule::new) + .collect(Collectors.toList()); } @CheckForNull diff --git a/sonar-plugin/css/src/test/java/org/sonar/css/metrics/CssMetricSensorTest.java b/sonar-plugin/css/src/test/java/org/sonar/css/metrics/CssMetricSensorTest.java index 16048b0e8d9..1b1b2dc17a8 100644 --- a/sonar-plugin/css/src/test/java/org/sonar/css/metrics/CssMetricSensorTest.java +++ b/sonar-plugin/css/src/test/java/org/sonar/css/metrics/CssMetricSensorTest.java @@ -72,8 +72,9 @@ void test_descriptor_sonarlint() { var sonarlintDescriptor = new org.sonarsource.sonarlint.core.analysis.sonarapi.DefaultSensorDescriptor(); // should not throw as 'processesFilesIndependently' is not executed for SonarLint - new CssMetricSensor(SonarRuntimeImpl.forSonarLint(Version.create(8, 9)), null) - .describe(sonarlintDescriptor); + new CssMetricSensor(SonarRuntimeImpl.forSonarLint(Version.create(8, 9)), null).describe( + sonarlintDescriptor + ); assertThat(sonarlintDescriptor.name()).isEqualTo("CSS Metrics"); } @@ -244,12 +245,11 @@ private void executeSensor(String content) throws IOException { private void executeSensor(String content, InputFile.Type type) throws IOException { File file = tempFolder.resolve("file.js").toFile(); - inputFile = - new TestInputFileBuilder("moduleKey", file.getName()) - .setLanguage("css") - .setType(type) - .setContents(content) - .build(); + inputFile = new TestInputFileBuilder("moduleKey", file.getName()) + .setLanguage("css") + .setType(type) + .setContents(content) + .build(); sensorContext = SensorContextTester.create(tempFolder.getRoot()); sensorContext.fileSystem().add(inputFile); @@ -269,12 +269,14 @@ private void assertHighlighting(int line, int column, int length, TypeOfText typ } private void assertLinesOfCode(int expected) { - assertThat(sensorContext.measure(inputFile.key(), CoreMetrics.NCLOC).value()) - .isEqualTo(expected); + assertThat(sensorContext.measure(inputFile.key(), CoreMetrics.NCLOC).value()).isEqualTo( + expected + ); } private void assertLinesOfComment(int expected) { - assertThat(sensorContext.measure(inputFile.key(), CoreMetrics.COMMENT_LINES).value()) - .isEqualTo(expected); + assertThat(sensorContext.measure(inputFile.key(), CoreMetrics.COMMENT_LINES).value()).isEqualTo( + expected + ); } } diff --git a/sonar-plugin/css/src/test/java/org/sonar/css/rules/CssRuleTest.java b/sonar-plugin/css/src/test/java/org/sonar/css/rules/CssRuleTest.java index 232478ebd8e..5552193e70e 100644 --- a/sonar-plugin/css/src/test/java/org/sonar/css/rules/CssRuleTest.java +++ b/sonar-plugin/css/src/test/java/org/sonar/css/rules/CssRuleTest.java @@ -39,8 +39,9 @@ void class_name_should_match_stylelint_key() .stylelintKey() .replace("-", "") .replace("sonar/", ""); - assertThat(ruleClass.getSimpleName()) - .isEqualToIgnoringCase(stylelintRuleKeyWithoutUnderscore); + assertThat(ruleClass.getSimpleName()).isEqualToIgnoringCase( + stylelintRuleKeyWithoutUnderscore + ); } } @@ -89,10 +90,9 @@ void rules_properties_count() { void selector_pseudo_class_options() { SelectorPseudoClassNoUnknown selectorPseudoClassNoUnknown = new SelectorPseudoClassNoUnknown(); String optionsAsJson = new Gson().toJson(selectorPseudoClassNoUnknown.stylelintOptions()); - assertThat(optionsAsJson) - .isEqualTo( - "[true,{\"ignorePseudoClasses\":[\"local\",\"global\",\"export\",\"import\",\"deep\"]}]" - ); + assertThat(optionsAsJson).isEqualTo( + "[true,{\"ignorePseudoClasses\":[\"local\",\"global\",\"export\",\"import\",\"deep\"]}]" + ); selectorPseudoClassNoUnknown.ignoredPseudoClasses = "foo,/^bar/"; optionsAsJson = new Gson().toJson(selectorPseudoClassNoUnknown.stylelintOptions()); assertThat(optionsAsJson).isEqualTo("[true,{\"ignorePseudoClasses\":[\"foo\",\"/^bar/\"]}]"); @@ -101,17 +101,17 @@ void selector_pseudo_class_options() { @Test void property_no_unknown_options() { String optionsAsJson = new Gson().toJson(new PropertyNoUnknown().stylelintOptions()); - assertThat(optionsAsJson) - .isEqualTo( - "[true,{\"ignoreProperties\":[\"composes\",\"/^mso-/\"],\"ignoreSelectors\":[\"/^:export.*/\",\"/^:import.*/\"]}]" - ); + assertThat(optionsAsJson).isEqualTo( + "[true,{\"ignoreProperties\":[\"composes\",\"/^mso-/\"],\"ignoreSelectors\":[\"/^:export.*/\",\"/^:import.*/\"]}]" + ); } @Test void selector_type_no_unknown_default() { String optionsAsJson = new Gson().toJson(new SelectorTypeNoUnknown().stylelintOptions()); - assertThat(optionsAsJson) - .isEqualTo("[true,{\"ignoreTypes\":[\"/^(mat|md|fa)-/\"],\"ignore\":[\"custom-elements\"]}]"); + assertThat(optionsAsJson).isEqualTo( + "[true,{\"ignoreTypes\":[\"/^(mat|md|fa)-/\"],\"ignore\":[\"custom-elements\"]}]" + ); } @Test @@ -120,18 +120,18 @@ void selector_type_no_unknown_custom() { selectorTypeNoUnknown.ignoreTypes = "/^(mat|md|fa)-/"; selectorTypeNoUnknown.ignore = "custom-elements, default-namespace"; String optionsAsJson = new Gson().toJson(selectorTypeNoUnknown.stylelintOptions()); - assertThat(optionsAsJson) - .isEqualTo( - "[true,{\"ignoreTypes\":[\"/^(mat|md|fa)-/\"],\"ignore\":[\"custom-elements\",\"default-namespace\"]}]" - ); + assertThat(optionsAsJson).isEqualTo( + "[true,{\"ignoreTypes\":[\"/^(mat|md|fa)-/\"],\"ignore\":[\"custom-elements\",\"default-namespace\"]}]" + ); } @Test void selector_pseudo_element_no_unknown_default() { String optionsAsJson = new Gson() .toJson(new SelectorPseudoElementNoUnknown().stylelintOptions()); - assertThat(optionsAsJson) - .isEqualTo("[true,{\"ignorePseudoElements\":[\"ng-deep\",\"v-deep\",\"deep\"]}]"); + assertThat(optionsAsJson).isEqualTo( + "[true,{\"ignorePseudoElements\":[\"ng-deep\",\"v-deep\",\"deep\"]}]" + ); } @Test @@ -140,17 +140,17 @@ void selector_pseudo_element_no_unknown_custom() { new SelectorPseudoElementNoUnknown(); selectorPseudoElementNoUnknown.ignorePseudoElements = "ng-deep, /^custom-/"; String optionsAsJson = new Gson().toJson(selectorPseudoElementNoUnknown.stylelintOptions()); - assertThat(optionsAsJson) - .isEqualTo("[true,{\"ignorePseudoElements\":[\"ng-deep\",\"/^custom-/\"]}]"); + assertThat(optionsAsJson).isEqualTo( + "[true,{\"ignorePseudoElements\":[\"ng-deep\",\"/^custom-/\"]}]" + ); } @Test void at_rule_unknown_default() { String optionsAsJson = new Gson().toJson(new AtRuleNoUnknown().stylelintOptions()); - assertThat(optionsAsJson) - .isEqualTo( - "[true,{\"ignoreAtRules\":[\"value\",\"at-root\",\"content\",\"debug\",\"each\",\"else\",\"error\",\"for\",\"function\",\"if\",\"include\",\"mixin\",\"return\",\"warn\",\"while\",\"extend\",\"use\",\"forward\",\"tailwind\",\"apply\",\"layer\",\"container\",\"/^@.*/\"]}]" - ); + assertThat(optionsAsJson).isEqualTo( + "[true,{\"ignoreAtRules\":[\"value\",\"at-root\",\"content\",\"debug\",\"each\",\"else\",\"error\",\"for\",\"function\",\"if\",\"include\",\"mixin\",\"return\",\"warn\",\"while\",\"extend\",\"use\",\"forward\",\"tailwind\",\"apply\",\"layer\",\"container\",\"/^@.*/\"]}]" + ); } @Test @@ -165,8 +165,9 @@ void at_rule_unknown_custom() { void declaration_block_no_duplicate_properties_default() { String optionsAsJson = new Gson() .toJson(new DeclarationBlockNoDuplicateProperties().stylelintOptions()); - assertThat(optionsAsJson) - .isEqualTo("[true,{\"ignore\":[\"consecutive-duplicates-with-different-values\"]}]"); + assertThat(optionsAsJson).isEqualTo( + "[true,{\"ignore\":[\"consecutive-duplicates-with-different-values\"]}]" + ); } @Test @@ -189,7 +190,8 @@ void font_family_no_missing_generic_family_keyword_custom() { new FontFamilyNoMissingGenericFamilyKeyword(); instance.ignoreFontFamilies = "Icon Font, /icon$/"; String optionsAsJson = new Gson().toJson(instance.stylelintOptions()); - assertThat(optionsAsJson) - .isEqualTo("[true,{\"ignoreFontFamilies\":[\"Icon Font\",\"/icon$/\"]}]"); + assertThat(optionsAsJson).isEqualTo( + "[true,{\"ignoreFontFamilies\":[\"Icon Font\",\"/icon$/\"]}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S100.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S100.java index b2561e3d0b1..74f5a9b2b89 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S100.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S100.java @@ -42,6 +42,4 @@ public class S100 extends Check { public List configurations() { return Collections.singletonList(new FormatRuleProperty(format)); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S101.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S101.java index d19baf263ad..213c033b453 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S101.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S101.java @@ -42,6 +42,4 @@ public class S101 extends Check { public List configurations() { return Collections.singletonList(new FormatRuleProperty(format)); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S103.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S103.java index 103bdee2261..ceb0ce8bfb3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S103.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S103.java @@ -49,6 +49,4 @@ public List configurations() { configurationsMap.put("tabWidth", 1); return Collections.singletonList(configurationsMap); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S104.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S104.java index e4da80ff8e2..7dfff00a111 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S104.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S104.java @@ -40,13 +40,9 @@ public class S104 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(maximum) - ); + return Collections.singletonList(new Config(maximum)); } - - private static class Config { int maximum; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S105.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S105.java index 00773b2280a..8880a61ec21 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S105.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S105.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "TabCharacter") @Rule(key = "S105") -public class S105 extends Check { - - -} +public class S105 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S106.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S106.java index 5d6e6daf0cc..0aedbacfa61 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S106.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S106.java @@ -32,8 +32,6 @@ @Rule(key = "S106") public class S106 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1066.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1066.java index 14e30c55b12..ce63187f436 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1066.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1066.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "CollapsibleIfStatements") @Rule(key = "S1066") -public class S1066 extends Check { - - -} +public class S1066 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1067.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1067.java index f05e4bbeadd..2af24926b5d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1067.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1067.java @@ -39,13 +39,9 @@ public class S1067 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(this.max) - ); + return Collections.singletonList(new Config(this.max)); } - - private static class Config { int max; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1068.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1068.java index c4d9096952d..b6762ee408a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1068.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1068.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S1068") -public class S1068 extends Check { - - -} +public class S1068 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S107.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S107.java index 557f96ae700..f69d9e3aa7d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S107.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S107.java @@ -42,13 +42,9 @@ public class S107 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(maximumFunctionParameters) - ); + return Collections.singletonList(new Config(maximumFunctionParameters)); } - - private static class Config { int max; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1077.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1077.java index b370dd9be80..93edffbe139 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1077.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1077.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S1077") -public class S1077 extends Check { - - -} +public class S1077 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S108.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S108.java index 8db7f32a45f..b710000e54d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S108.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S108.java @@ -35,8 +35,6 @@ public List configurations() { return Collections.singletonList(new Config()); } - - private static class Config { boolean allowEmptyCatch = true; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1082.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1082.java index a333ac7c7ff..9c42b569121 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1082.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1082.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1082") -public class S1082 extends Check { - - -} +public class S1082 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S109.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S109.java index b002e33fd62..abed08f3316 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S109.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S109.java @@ -33,8 +33,6 @@ public List configurations() { return Collections.singletonList(new Config()); } - - private static class Config { int[] ignore = { 0, 1, -1, 24, 60 }; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1090.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1090.java index 6c46762fafa..1cc6462d869 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1090.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1090.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "S6854") @Rule(key = "S1090") -public class S1090 extends Check { - - -} +public class S1090 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1105.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1105.java index beed832a074..7a21fa3a9a5 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1105.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1105.java @@ -43,8 +43,6 @@ public List configurations() { return Arrays.asList(braceStyle, new Config()); } - - private static class Config { boolean allowSingleLine = true; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1110.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1110.java index 209cfd452ec..b1d134a3969 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1110.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1110.java @@ -26,7 +26,4 @@ @JavaScriptRule @DeprecatedRuleKey(ruleKey = "Parentheses") @Rule(key = "S1110") -public class S1110 extends Check { - - -} +public class S1110 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1116.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1116.java index c36b591fea3..7e119a79358 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1116.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1116.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1116") -public class S1116 extends Check { - - -} +public class S1116 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1117.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1117.java index f0a260a6cf6..529d5fc0004 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1117.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1117.java @@ -31,8 +31,6 @@ @Rule(key = "S1117") public class S1117 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1119.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1119.java index 9fed007dd6c..3f56b39190e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1119.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1119.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1119") -public class S1119 extends Check { - - -} +public class S1119 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1121.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1121.java index ad47e41b185..756082c4e6b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1121.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1121.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "AssignmentWithinCondition") @Rule(key = "S1121") -public class S1121 extends Check { - - -} +public class S1121 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1125.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1125.java index 31fe30aec8c..20e2ba06419 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1125.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1125.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1125") -public class S1125 extends Check { - - -} +public class S1125 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1126.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1126.java index 83c062e93e9..64569edc483 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1126.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1126.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S1126") -public class S1126 extends Check { - - -} +public class S1126 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1128.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1128.java index d617e42e169..981410f9602 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1128.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1128.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1128") -public class S1128 extends Check { - - -} +public class S1128 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S113.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S113.java index 39b67a447ec..ad8e099e980 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S113.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S113.java @@ -34,6 +34,4 @@ public class S113 extends Check { public List configurations() { return Collections.singletonList("always"); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1131.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1131.java index 4a6407c828a..226736a4f12 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1131.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1131.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S1131") @DeprecatedRuleKey(ruleKey = "TrailingWhitespace") -public class S1131 extends Check { - - -} +public class S1131 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1134.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1134.java index bb937eede75..e0a1a3cd2b5 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1134.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1134.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1134") -public class S1134 extends Check { - - -} +public class S1134 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1135.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1135.java index 79799582663..432c1a6fc7d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1135.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1135.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1135") -public class S1135 extends Check { - - -} +public class S1135 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1143.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1143.java index 7908e07b2fa..8c5c6ed2130 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1143.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1143.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1143") -public class S1143 extends Check { - - -} +public class S1143 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1154.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1154.java index 69afe068ae4..79603c6f9e0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1154.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1154.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1154") -public class S1154 extends Check { - - -} +public class S1154 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S117.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S117.java index c54a5d8de89..4e477891693 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S117.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S117.java @@ -45,6 +45,4 @@ public class S117 extends Check { public List configurations() { return Collections.singletonList(new FormatRuleProperty(format)); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1172.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1172.java index a0ec744390d..f90a40e2059 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1172.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1172.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S1172") @DeprecatedRuleKey(ruleKey = "UnusedFunctionArgument") -public class S1172 extends Check { - - -} +public class S1172 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1186.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1186.java index a70ac7f256d..2094446dbf9 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1186.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1186.java @@ -28,8 +28,6 @@ @Rule(key = "S1186") public class S1186 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1192.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1192.java index ae5d5a77642..3cbd7381942 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1192.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1192.java @@ -52,6 +52,7 @@ public List configurations() { } private static class Config { + int threshold; String ignoreStrings; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1199.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1199.java index 9fd5a21bef4..adef7fb80b6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1199.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1199.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S1199") -public class S1199 extends Check { - - -} +public class S1199 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S121.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S121.java index a1cb5e74222..2b2cdde614b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S121.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S121.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "CurlyBraces") @Rule(key = "S121") -public class S121 extends Check { - - -} +public class S121 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1219.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1219.java index cf5061b5f8b..293f64710d3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1219.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1219.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1219") -public class S1219 extends Check { - - -} +public class S1219 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S122.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S122.java index e1f3e7af200..8dee70f8cfb 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S122.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S122.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S122") @DeprecatedRuleKey(ruleKey = "OneStatementPerLine") -public class S122 extends Check { - - -} +public class S122 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1226.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1226.java index cd93062e120..0449d6d1284 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1226.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1226.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1226") -public class S1226 extends Check { - - -} +public class S1226 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S124.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S124.java index 674df3462c9..ee9832db7a9 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S124.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S124.java @@ -52,13 +52,9 @@ public class S124 extends Check { ) public String flags = DEFAULT_FLAGS; - - @Override public List configurations() { - return Collections.singletonList( - new S124.Config(regularExpression, message, flags) - ); + return Collections.singletonList(new S124.Config(regularExpression, message, flags)); } private static class Config { diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S125.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S125.java index 9650434fbab..c2e9231b2bf 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S125.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S125.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "CommentedCode") @Rule(key = "S125") -public class S125 extends Check { - - -} +public class S125 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S126.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S126.java index c6086d1c95d..cf8a6c73b6b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S126.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S126.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "ElseIfWithoutElse") @Rule(key = "S126") -public class S126 extends Check { - - -} +public class S126 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1264.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1264.java index 510600bca8c..09fe4dc8d3f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1264.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1264.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1264") -public class S1264 extends Check { - - -} +public class S1264 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S128.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S128.java index 4d0c6ebddb4..26ad8ee783e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S128.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S128.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "NonEmptyCaseWithoutBreak") @Rule(key = "S128") -public class S128 extends Check { - - -} +public class S128 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1291.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1291.java index 180da079a81..3b25da383dd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1291.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1291.java @@ -24,6 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1291") -public class S1291 extends Check { - -} +public class S1291 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1301.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1301.java index 2ad643ce9af..dcab4ce311c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1301.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1301.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1301") -public class S1301 extends Check { - - -} +public class S1301 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S131.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S131.java index 0a06485a446..db2b2007795 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S131.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S131.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S131") @DeprecatedRuleKey(ruleKey = "SwitchWithoutDefault") -public class S131 extends Check { - - -} +public class S131 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1313.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1313.java index 0914168b742..fa53e4cffa2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1313.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1313.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S1313") -public class S1313 extends Check { - - -} +public class S1313 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1314.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1314.java index 492b0887e32..d23ea61f2c2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1314.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1314.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S1314") @DeprecatedRuleKey(ruleKey = "OctalNumber") -public class S1314 extends Check { - - -} +public class S1314 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1321.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1321.java index bbb493e1acf..e9499aa19c3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1321.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1321.java @@ -24,7 +24,4 @@ @JavaScriptRule @Rule(key = "S1321") @DeprecatedRuleKey(ruleKey = "WithStatement") -public class S1321 extends Check { - - -} +public class S1321 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S134.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S134.java index 8aa359b8171..adfdf34447e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S134.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S134.java @@ -45,8 +45,6 @@ public List configurations() { return Collections.singletonList(new Config(maximumNestingLevel)); } - - private static class Config { int maximumNestingLevel; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S135.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S135.java index 88ec63fea73..2b419868c72 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S135.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S135.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S135") @DeprecatedRuleKey(ruleKey = "TooManyBreakOrContinueInLoop") -public class S135 extends Check { - - -} +public class S135 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S138.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S138.java index cfa4c75c844..857b93dabe8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S138.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S138.java @@ -40,13 +40,9 @@ public class S138 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(max) - ); + return Collections.singletonList(new Config(max)); } - - private static class Config { int maximum; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S139.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S139.java index 097af7b6e91..1667c79efcd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S139.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S139.java @@ -40,8 +40,6 @@ public class S139 extends Check { ) String legalCommentPattern = DEFAULT_LEGAL_COMMENT_PATTERN; - - @Override public List configurations() { return Collections.singletonList(new Config(legalCommentPattern)); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1438.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1438.java index f3227ec5917..a3f12cccfd3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1438.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1438.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S1438") @DeprecatedRuleKey(ruleKey = "Semicolon") -public class S1438 extends Check { - - -} +public class S1438 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1439.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1439.java index 0c7b04a06f3..b38b40943d5 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1439.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1439.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "LabelPlacement") @Rule(key = "S1439") -public class S1439 extends Check { - - -} +public class S1439 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1440.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1440.java index b190596c700..2ea14074df0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1440.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1440.java @@ -34,6 +34,4 @@ public class S1440 extends Check { public List configurations() { return Collections.singletonList("smart"); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1441.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1441.java index 4e2002031ea..056a2c17cf6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1441.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1441.java @@ -45,8 +45,6 @@ public List configurations() { return Arrays.asList(singleQuotes ? "single" : "double", new Config()); } - - private static class Config { boolean avoidEscape = true; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1442.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1442.java index c30dfb009a7..b55148cfc91 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1442.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1442.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S1442") -public class S1442 extends Check { - - -} +public class S1442 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1444.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1444.java index 66fc3071d1b..76764b48d09 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1444.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1444.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S1444") -public class S1444 extends Check { - - -} +public class S1444 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1451.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1451.java index 04377d366e9..bb6869203dd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1451.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1451.java @@ -51,8 +51,6 @@ public List configurations() { return Collections.singletonList(new Config(headerFormat, isRegularExpression)); } - - private static class Config { String headerFormat; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1472.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1472.java index d9c862abf42..172dd2e877c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1472.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1472.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1472") -public class S1472 extends Check { - - -} +public class S1472 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1479.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1479.java index b2618ed6466..5a09869358d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1479.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1479.java @@ -42,6 +42,4 @@ public class S1479 extends Check { public List configurations() { return Collections.singletonList(maximum); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1481.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1481.java index caf6b0ef6a3..9a10e1ffc56 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1481.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1481.java @@ -24,7 +24,4 @@ @JavaScriptRule @Rule(key = "S1481") @DeprecatedRuleKey(ruleKey = "UnusedVariable") -public class S1481 extends Check { - - -} +public class S1481 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1488.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1488.java index 569ebee24a0..4848aaa2731 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1488.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1488.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1488") -public class S1488 extends Check { - - -} +public class S1488 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1515.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1515.java index 27c8f52495b..d46df06ab91 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1515.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1515.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "FunctionDefinitionInsideLoop") @Rule(key = "S1515") -public class S1515 extends Check { - - -} +public class S1515 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1516.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1516.java index 8933a261c68..ad8d6487657 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1516.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1516.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "MultilineStringLiterals") @Rule(key = "S1516") -public class S1516 extends Check { - - -} +public class S1516 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1523.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1523.java index bbfe25aded6..167010888c8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1523.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1523.java @@ -26,7 +26,4 @@ @JavaScriptRule @Rule(key = "S1523") @DeprecatedRuleKey(ruleKey = "Eval") -public class S1523 extends Check { - - -} +public class S1523 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1525.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1525.java index d1e4e911154..a59af12a6ef 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1525.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1525.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "DebuggerStatement") @Rule(key = "S1525") -public class S1525 extends Check { - - -} +public class S1525 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1526.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1526.java index 9dbe4852aea..5c73b5c61bf 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1526.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1526.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "VariableDeclarationAfterUsage") @Rule(key = "S1526") -public class S1526 extends Check { - - -} +public class S1526 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1527.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1527.java index dbc8899e117..d785fe3c4e6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1527.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1527.java @@ -24,7 +24,4 @@ @JavaScriptRule @Rule(key = "S1527") @DeprecatedRuleKey(ruleKey = "FutureReservedWords") -public class S1527 extends Check { - - -} +public class S1527 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1528.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1528.java index ccc9a65b833..4900357f6fc 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1528.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1528.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S1528") @DeprecatedRuleKey(ruleKey = "ArrayAndObjectConstructors") -public class S1528 extends Check { - - -} +public class S1528 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1529.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1529.java index aa865332127..f645baa4418 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1529.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1529.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "BitwiseOperators") @Rule(key = "S1529") -public class S1529 extends Check { - - -} +public class S1529 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1530.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1530.java index 4c3a376b2a4..ff18547cc86 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1530.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1530.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "FunctionDeclarationsWithinBlocks") @Rule(key = "S1530") -public class S1530 extends Check { - - -} +public class S1530 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1533.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1533.java index d7a08819dc2..9da7fa38903 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1533.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1533.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "PrimitiveWrappers") @Rule(key = "S1533") -public class S1533 extends Check { - - -} +public class S1533 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1534.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1534.java index 27945f67565..53bbefb3c82 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1534.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1534.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S1534") @DeprecatedRuleKey(ruleKey = "DuplicatePropertyName") -public class S1534 extends Check { - - -} +public class S1534 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1535.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1535.java index 6ee37607fb7..140cce59cb0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1535.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1535.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S1535") @DeprecatedRuleKey(ruleKey = "ForIn") -public class S1535 extends Check { - - -} +public class S1535 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1536.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1536.java index a9723b7a1b5..dda071351af 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1536.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1536.java @@ -24,7 +24,4 @@ @JavaScriptRule @Rule(key = "S1536") @DeprecatedRuleKey(ruleKey = "DuplicateFunctionArgument") -public class S1536 extends Check { - - -} +public class S1536 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1537.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1537.java index a095440c7db..67755dcd474 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1537.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1537.java @@ -29,7 +29,4 @@ @TypeScriptRule @Rule(key = "S1537") @DeprecatedRuleKey(ruleKey = "TrailingComma") -public class S1537 extends Check { - - -} +public class S1537 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1539.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1539.java index 80cd04f301b..59be1a34dc5 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1539.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1539.java @@ -34,6 +34,4 @@ public class S1539 extends Check { public List configurations() { return Collections.singletonList("never"); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1541Js.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1541Js.java index a5cb3eef41f..b69521e6121 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1541Js.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1541Js.java @@ -43,13 +43,9 @@ public class S1541Js extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(threshold) - ); + return Collections.singletonList(new Config(threshold)); } - - private static class Config { int threshold; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1541Ts.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1541Ts.java index 982f2d05b2f..f0ab2e07505 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1541Ts.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1541Ts.java @@ -38,12 +38,9 @@ public class S1541Ts extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(threshold) - ); + return Collections.singletonList(new Config(threshold)); } - private static class Config { int threshold; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1607.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1607.java index adb8fa9641f..d0a461189fd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1607.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1607.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1607") -public class S1607 extends TestFileCheck { - - -} +public class S1607 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1656.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1656.java index fb37b5f8106..b311c42b257 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1656.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1656.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1656") -public class S1656 extends Check { - - -} +public class S1656 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1751.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1751.java index ee734f9c498..d4d5fe570b0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1751.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1751.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1751") -public class S1751 extends Check { - - -} +public class S1751 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1763.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1763.java index fa36b4e09b2..ebafc712eb1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1763.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1763.java @@ -27,7 +27,4 @@ @Rule(key = "S1763") @DeprecatedRuleKey(ruleKey = "S1736") @DeprecatedRuleKey(ruleKey = "UnreachableCode") -public class S1763 extends Check { - - -} +public class S1763 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1764.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1764.java index 5b22a5b7e8b..95bfb093e58 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1764.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1764.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1764") -public class S1764 extends Check { - - -} +public class S1764 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1774.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1774.java index 96bc7c302b5..7c642a2305c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1774.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1774.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S1774") @DeprecatedRuleKey(ruleKey = "ConditionalOperator") -public class S1774 extends Check { - - -} +public class S1774 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1788.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1788.java index 46363e843da..83d0142a0c4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1788.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1788.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1788") -public class S1788 extends Check { - - -} +public class S1788 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1821.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1821.java index a4d77c32ca7..a00722c9bb5 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1821.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1821.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1821") -public class S1821 extends Check { - - -} +public class S1821 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1848.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1848.java index c83abce1d29..4a65f20945f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1848.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1848.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "ConstructorFunctionsForSideEffects") @Rule(key = "S1848") -public class S1848 extends Check { - - -} +public class S1848 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1854.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1854.java index 7a30d5293eb..4643ef7f707 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1854.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1854.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S1854") -public class S1854 extends Check { - - -} +public class S1854 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1862.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1862.java index be520599e22..63e1bc64657 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1862.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1862.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1862") -public class S1862 extends Check { - - -} +public class S1862 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1871.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1871.java index 26716a55859..51ae3511a2a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1871.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1871.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1871") -public class S1871 extends Check { - - -} +public class S1871 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1874.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1874.java index 7524f8cf514..e52dfc0a80d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1874.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1874.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1874") -public class S1874 extends Check { - - -} +public class S1874 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1940.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1940.java index 49f0658b81e..e5e14097d2d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1940.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1940.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1940") -public class S1940 extends Check { - - -} +public class S1940 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1994.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1994.java index 8973020f38b..36dd82ad802 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1994.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S1994.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S1994") -public class S1994 extends Check { - - -} +public class S1994 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2004.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2004.java index 58826e2fa67..44e1ff55fc1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2004.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2004.java @@ -40,13 +40,9 @@ public class S2004 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(threshold) - ); + return Collections.singletonList(new Config(threshold)); } - - private static class Config { int threshold; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2068.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2068.java index fa5c0c29dc8..945a42184ca 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2068.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2068.java @@ -42,13 +42,14 @@ public class S2068 extends Check { @Override public List configurations() { return Collections.singletonList( - new Config( - Arrays.stream(passwordWords.split(",")).map(String::trim).toArray(String[]::new)) + new Config(Arrays.stream(passwordWords.split(",")).map(String::trim).toArray(String[]::new)) ); } private static class Config { + String[] passwordWords; + Config(String[] passwordWords) { this.passwordWords = passwordWords; } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2077.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2077.java index 9c3e3fe8a9d..41ea31e4b5d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2077.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2077.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2077") -public class S2077 extends Check { - - -} +public class S2077 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2092.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2092.java index c19cfa591ce..25380e68eb6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2092.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2092.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2092") -public class S2092 extends Check { - - -} +public class S2092 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2094.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2094.java index f2407b82395..9b539c556c1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2094.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2094.java @@ -28,8 +28,6 @@ @Rule(key = "S2094") public class S2094 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2123.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2123.java index e7586b0ef63..cbf4d7fb2f7 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2123.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2123.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2123") -public class S2123 extends Check { - - -} +public class S2123 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2137.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2137.java index 5ac9977d9c8..11fdfd4e15a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2137.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2137.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2137") -public class S2137 extends Check { - - -} +public class S2137 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2138.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2138.java index 8e0ecde0e27..968f95c7a90 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2138.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2138.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2138") -public class S2138 extends Check { - - -} +public class S2138 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2187.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2187.java index 08d47618d51..68fa96b476e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2187.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2187.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2187") -public class S2187 extends TestFileCheck { - - -} +public class S2187 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2189.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2189.java index 1bdb081b267..d3791b83b18 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2189.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2189.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S2189") -public class S2189 extends Check { - - -} +public class S2189 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2201.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2201.java index 3b910a89f02..1242832babf 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2201.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2201.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2201") -public class S2201 extends Check { - - -} +public class S2201 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2208.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2208.java index cc41b76b169..aa04635ad22 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2208.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2208.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2208") -public class S2208 extends Check { - - -} +public class S2208 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2234.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2234.java index f53b06eef71..5cfee1eceef 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2234.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2234.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2234") -public class S2234 extends Check { - - -} +public class S2234 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2245.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2245.java index 260c9aa5ccb..a4eee19c91e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2245.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2245.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2245") -public class S2245 extends Check { - - -} +public class S2245 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2251.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2251.java index f6a062608cf..e21b3cf8abc 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2251.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2251.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2251") -public class S2251 extends Check { - - -} +public class S2251 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2255.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2255.java index d0726a3af27..28b58e1261f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2255.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2255.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2255") -public class S2255 extends Check { - - -} +public class S2255 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2259.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2259.java index 21b784d8f0c..a8a2e7eefd1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2259.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2259.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S2259") -public class S2259 extends Check { - - -} +public class S2259 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2301.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2301.java index 9805755ade3..2f69e5d48ec 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2301.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2301.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2301") -public class S2301 extends Check { - - -} +public class S2301 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2310.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2310.java index dc2f3138ee5..d5499e97560 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2310.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2310.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2310") -public class S2310 extends Check { - - -} +public class S2310 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2376.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2376.java index d80c1093a35..ce09c58330d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2376.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2376.java @@ -40,13 +40,9 @@ public class S2376 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(getWithoutSet) - ); + return Collections.singletonList(new Config(getWithoutSet)); } - - private static class Config { boolean getWithoutSet; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2392.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2392.java index 5b78e03f5bb..16959854cd5 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2392.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2392.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2392") -public class S2392 extends Check { - - -} +public class S2392 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2424.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2424.java index 90e0617c5be..4c850b5c268 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2424.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2424.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2424") -public class S2424 extends Check { - - -} +public class S2424 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2427.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2427.java index d95ce7dea77..1973eca8b42 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2427.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2427.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2427") -public class S2427 extends Check { - - -} +public class S2427 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2428.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2428.java index 333205a1c9d..704fef70375 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2428.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2428.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S2428") -public class S2428 extends Check { - - -} +public class S2428 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2430.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2430.java index 6e7969e1a99..daed6d209bd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2430.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2430.java @@ -28,8 +28,6 @@ @Rule(key = "S2430") public class S2430 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2432.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2432.java index 1784c0d3fa1..1026984a6b2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2432.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2432.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S2432") -public class S2432 extends Check { - - -} +public class S2432 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2486.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2486.java index 2fcc4ce2be6..1aa136d3f2d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2486.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2486.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2486") -public class S2486 extends TestFileCheck { - - -} +public class S2486 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2589.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2589.java index f9995782fab..8d9454924cd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2589.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2589.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S2589") -public class S2589 extends Check { - - -} +public class S2589 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2598.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2598.java index a58a78c4277..d524a9d7d9f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2598.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2598.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2598") -public class S2598 extends Check { - - -} +public class S2598 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2612.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2612.java index e6d9d145f8a..2574d351974 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2612.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2612.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2612") -public class S2612 extends Check { - - -} +public class S2612 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2639.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2639.java index 4303d118f10..44785fcefaa 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2639.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2639.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2639") -public class S2639 extends Check { - - -} +public class S2639 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2681.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2681.java index 4d9b4409703..635a8607d39 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2681.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2681.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2681") -public class S2681 extends Check { - - -} +public class S2681 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2685.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2685.java index a2118be5aa8..03145b67c3f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2685.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2685.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2685") -public class S2685 extends Check { - - -} +public class S2685 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2688.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2688.java index 2cd74647126..ce15f02afcd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2688.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2688.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2688") -public class S2688 extends Check { - - -} +public class S2688 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2692.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2692.java index 88251196b22..7756cbdf69f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2692.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2692.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2692") -public class S2692 extends Check { - - -} +public class S2692 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2699.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2699.java index 3c685a6df09..2e501176e03 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2699.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2699.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2699") -public class S2699 extends TestFileCheck { - - -} +public class S2699 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2703.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2703.java index 558cb370961..42c2c3778cc 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2703.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2703.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S2703") -public class S2703 extends Check { - - -} +public class S2703 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2737.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2737.java index 1a518a02df1..5c1912a21fc 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2737.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2737.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2737") -public class S2737 extends Check { - - -} +public class S2737 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2755.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2755.java index fd1e5f9d128..aa706d93f41 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2755.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2755.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2755") -public class S2755 extends Check { - - -} +public class S2755 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2757.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2757.java index 47c5b51b5d3..759924818ea 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2757.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2757.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2757") -public class S2757 extends Check { - - -} +public class S2757 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2814.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2814.java index b10b2186b55..121fd1f90e1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2814.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2814.java @@ -31,8 +31,6 @@ public List configurations() { return Collections.singletonList(new Config()); } - - private static class Config { boolean builtinGlobals = false; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2817.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2817.java index 5f88b33535a..62b015ccc58 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2817.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2817.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2817") -public class S2817 extends Check { - - -} +public class S2817 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2819.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2819.java index d93df450192..644df6eac74 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2819.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2819.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2819") -public class S2819 extends Check { - - -} +public class S2819 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2870.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2870.java index f48f2935ed5..48e8a6ec2fc 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2870.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2870.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2870") -public class S2870 extends Check { - - -} +public class S2870 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2871.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2871.java index 57070004cce..12579f002d4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2871.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2871.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2871") -public class S2871 extends Check { - - -} +public class S2871 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2933.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2933.java index 289bd6e3d72..20e75539f01 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2933.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2933.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S2933") -public class S2933 extends Check { - - -} +public class S2933 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2966.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2966.java index 549e234a9d3..7443d1551f4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2966.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2966.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S2966") -public class S2966 extends Check { - - -} +public class S2966 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2970.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2970.java index bb87db6186e..2eaa7264dde 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2970.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2970.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S2970") -public class S2970 extends TestFileCheck { - - -} +public class S2970 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2990.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2990.java index 3b0b593b84e..67d334fd971 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2990.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2990.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S2990") -public class S2990 extends Check { - - -} +public class S2990 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2999.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2999.java index fb13a5e7318..eb2a8b7b14c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2999.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S2999.java @@ -38,15 +38,15 @@ public class S2999 extends Check { ) public boolean considerJSDoc = CONSIDER_JSDOC; - - @Override public List configurations() { return Collections.singletonList(new Config(considerJSDoc)); } private static class Config { + boolean considerJSDoc; + Config(boolean considerJSDoc) { this.considerJSDoc = considerJSDoc; } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3001.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3001.java index d2220df6f9c..4e9a6baa1e1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3001.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3001.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3001") -public class S3001 extends Check { - - -} +public class S3001 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3003.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3003.java index a67f230cb1f..335d21f4817 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3003.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3003.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3003") -public class S3003 extends Check { - - -} +public class S3003 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3257.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3257.java index 069eb5f6dad..4ad2efd1d9a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3257.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3257.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S3257") -public class S3257 extends Check { - - -} +public class S3257 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3317.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3317.java index 65e31def868..b69e425a183 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3317.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3317.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3317") -public class S3317 extends Check { - - -} +public class S3317 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3330.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3330.java index b6e1806dba7..6b2639dd4f3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3330.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3330.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3330") -public class S3330 extends Check { - - -} +public class S3330 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3353.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3353.java index f2d63d96cbd..08fc7e07a5a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3353.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3353.java @@ -28,8 +28,6 @@ @Rule(key = "S3353") public class S3353 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Configuration()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3358.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3358.java index 6b7ab9b35ae..8235df38fcf 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3358.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3358.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3358") -public class S3358 extends Check { - - -} +public class S3358 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3402.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3402.java index bbdb261803f..0237a857b3d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3402.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3402.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3402") -public class S3402 extends Check { - - -} +public class S3402 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3403.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3403.java index f9589947075..36f244fde44 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3403.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3403.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3403") -public class S3403 extends Check { - - -} +public class S3403 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3498.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3498.java index 4407d86d52c..d74f27c4b87 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3498.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3498.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3498") -public class S3498 extends Check { - - -} +public class S3498 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3499.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3499.java index 761086e5d88..985d91ee094 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3499.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3499.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3499") -public class S3499 extends Check { - - -} +public class S3499 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3500.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3500.java index ce057e83e3e..4bb6b735c12 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3500.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3500.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3500") -public class S3500 extends Check { - - -} +public class S3500 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3504.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3504.java index 5b258cc333b..2f083268a5b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3504.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3504.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3504") -public class S3504 extends Check { - - -} +public class S3504 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3512.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3512.java index 9efc0a279a2..e6461497b6d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3512.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3512.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3512") -public class S3512 extends Check { - - -} +public class S3512 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3513.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3513.java index 297a7f75917..e0cd06816ef 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3513.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3513.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3513") -public class S3513 extends Check { - - -} +public class S3513 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3514.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3514.java index 32fe5a29626..ce643cde07e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3514.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3514.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3514") -public class S3514 extends Check { - - -} +public class S3514 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3516.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3516.java index 8af21d7e119..1ab35b5d7c0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3516.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3516.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3516") -public class S3516 extends Check { - - -} +public class S3516 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3523.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3523.java index 945445cc2cd..4389829be4b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3523.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3523.java @@ -22,6 +22,4 @@ @JavaScriptRule @Rule(key = "S3523") -public class S3523 extends Check { - -} +public class S3523 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3524.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3524.java index 1e110b276d1..73cb3b1b8ad 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3524.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3524.java @@ -46,8 +46,6 @@ public class S3524 extends Check { ) boolean bodyBraces = DEFAULT_BODY_BRACES; - - @Override public List configurations() { return Collections.singletonList(new Config(parameterParens, bodyBraces)); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3525.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3525.java index a677d16a35c..2330731514b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3525.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3525.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3525") -public class S3525 extends Check { - - -} +public class S3525 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3531.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3531.java index dccabd0df2f..d7d97f2e205 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3531.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3531.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3531") -public class S3531 extends Check { - - -} +public class S3531 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3533.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3533.java index 1a5054269a8..133d5d4e858 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3533.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3533.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S3533") -public class S3533 extends Check { - - -} +public class S3533 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3579.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3579.java index 5e5e8c1b92d..b3af0a31d5d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3579.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3579.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3579") -public class S3579 extends Check { - - -} +public class S3579 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3616.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3616.java index c8111a20866..d3c9181d283 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3616.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3616.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3616") -public class S3616 extends Check { - - -} +public class S3616 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3626.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3626.java index e4e95b628d2..aa44ff9c76a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3626.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3626.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3626") -public class S3626 extends Check { - - -} +public class S3626 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3686.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3686.java index 28943861cb3..37576fadf82 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3686.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3686.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3686") -public class S3686 extends Check { - - -} +public class S3686 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3696.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3696.java index 74eea4103a2..be51673e7c7 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3696.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3696.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S3696") -public class S3696 extends Check { - - -} +public class S3696 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3699.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3699.java index d2a2a6a060e..7fed10de026 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3699.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3699.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3699") -public class S3699 extends Check { - - -} +public class S3699 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3723.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3723.java index 62684ffddd4..880ca1c7ed6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3723.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3723.java @@ -28,8 +28,6 @@ @Rule(key = "S3723") public class S3723 extends Check { - - @Override public List configurations() { return Collections.singletonList("always-multiline"); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3735.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3735.java index d3845318d98..e23e520ab73 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3735.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3735.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3735") -public class S3735 extends Check { - - -} +public class S3735 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3757.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3757.java index 88f8b612dab..568b671106f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3757.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3757.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3757") -public class S3757 extends Check { - - -} +public class S3757 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3758.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3758.java index 85124f2f717..85f42bce42e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3758.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3758.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3758") -public class S3758 extends Check { - - -} +public class S3758 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3760.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3760.java index db54ae7f06f..243dc1be0a2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3760.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3760.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3760") -public class S3760 extends Check { - - -} +public class S3760 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3776.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3776.java index a9e06d5640a..b3ca7dc702a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3776.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3776.java @@ -38,8 +38,6 @@ public class S3776 extends Check { ) int threshold = DEFAULT_THRESHOLD; - - @Override public List configurations() { return Collections.singletonList(threshold); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3782.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3782.java index fc543bb2571..35076adb29a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3782.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3782.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3782") -public class S3782 extends Check { - - -} +public class S3782 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3785.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3785.java index eab95726a49..0aeca3272b6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3785.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3785.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3785") -public class S3785 extends Check { - - -} +public class S3785 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3786.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3786.java index 53321e74bea..3f162d3d449 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3786.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3786.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3786") -public class S3786 extends Check { - - -} +public class S3786 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3796.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3796.java index 213aab4fe71..ffa2004dd6c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3796.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3796.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3796") -public class S3796 extends Check { - - -} +public class S3796 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3798.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3798.java index 7fb52ac7f03..ca005a92271 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3798.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3798.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3798") -public class S3798 extends Check { - - -} +public class S3798 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3799.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3799.java index 86bd7bdc54b..e543236a73c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3799.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3799.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3799") -public class S3799 extends Check { - - -} +public class S3799 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3800.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3800.java index 4afdcf06577..3c3c7672a75 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3800.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3800.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3800") -public class S3800 extends Check { - - -} +public class S3800 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3801.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3801.java index 33c7fc4b5c2..84b4cf2e3e9 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3801.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3801.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3801") -public class S3801 extends Check { - - -} +public class S3801 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3812.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3812.java index 6d7a5260396..98960aaf0a6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3812.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3812.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3812") -public class S3812 extends Check { - - -} +public class S3812 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3827.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3827.java index 27f2d412471..3d032a4e6e7 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3827.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3827.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3827") -public class S3827 extends Check { - - -} +public class S3827 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3834.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3834.java index b63595a3013..11b67b6c4cb 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3834.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3834.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S3834") -public class S3834 extends Check { - - -} +public class S3834 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3854.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3854.java index ae00043b206..04d6c84e8a8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3854.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3854.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3854") -public class S3854 extends Check { - - -} +public class S3854 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3863.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3863.java index 3d85ed7834f..34ef681e28a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3863.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3863.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S3863") -public class S3863 extends Check { - - -} +public class S3863 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3923.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3923.java index 9fbfa86b718..e1c68684f1a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3923.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3923.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3923") -public class S3923 extends Check { - - -} +public class S3923 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3972.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3972.java index bae24b48fbf..aad4fd433a0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3972.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3972.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3972") -public class S3972 extends Check { - - -} +public class S3972 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3973.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3973.java index 0d0421193f9..0c2e66edc01 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3973.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3973.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3973") -public class S3973 extends Check { - - -} +public class S3973 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3981.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3981.java index 1bd04548a76..e9166d06adf 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3981.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3981.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3981") -public class S3981 extends Check { - - -} +public class S3981 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3984.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3984.java index b9800127ac5..075daba9feb 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3984.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S3984.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S3984") -public class S3984 extends Check { - - -} +public class S3984 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4023.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4023.java index d5baa0a6c57..4e639672761 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4023.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4023.java @@ -25,8 +25,6 @@ @Rule(key = "S4023") public class S4023 extends Check { - - @Override public List configurations() { return List.of(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4030.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4030.java index cad19c03b87..8fae0a4e19c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4030.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4030.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4030") -public class S4030 extends Check { - - -} +public class S4030 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4036.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4036.java index 336067d27e7..6e7f8d9e375 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4036.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4036.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S4036") -public class S4036 extends Check { - - -} +public class S4036 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4043.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4043.java index 58ef6d86a2a..7095c5a264f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4043.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4043.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4043") -public class S4043 extends Check { - - -} +public class S4043 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4084.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4084.java index c99bc6dff31..545f7807796 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4084.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4084.java @@ -26,7 +26,4 @@ @TypeScriptRule @DeprecatedRuleKey(ruleKey = "S6855") @Rule(key = "S4084") -public class S4084 extends Check { - - -} +public class S4084 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4123.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4123.java index e6e483c00b2..984284f89fa 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4123.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4123.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4123") -public class S4123 extends Check { - - -} +public class S4123 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4124.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4124.java index 929e0efccd4..17fb7a1b457 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4124.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4124.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4124") -public class S4124 extends Check { - - -} +public class S4124 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4125.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4125.java index 0034ed6d45c..6f76fd04ab2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4125.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4125.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S4125") -public class S4125 extends Check { - - -} +public class S4125 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4136.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4136.java index ac706b7be0b..f8b13ac9845 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4136.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4136.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4136") -public class S4136 extends Check { - - -} +public class S4136 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4137.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4137.java index 0470aea4015..0e24b6dbb7a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4137.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4137.java @@ -31,8 +31,6 @@ public List configurations() { return Collections.singletonList(new Config()); } - - private static class Config { String assertionStyle = "as"; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4138.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4138.java index adccd844021..90697a4e244 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4138.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4138.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4138") -public class S4138 extends Check { - - -} +public class S4138 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4139.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4139.java index 726611a5eb2..6d79b20afcf 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4139.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4139.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4139") -public class S4139 extends Check { - - -} +public class S4139 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4140.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4140.java index 7dcb6022eb0..966bad64961 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4140.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4140.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4140") -public class S4140 extends Check { - - -} +public class S4140 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4143.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4143.java index 791e9edce5d..c34224fc5a0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4143.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4143.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4143") -public class S4143 extends Check { - - -} +public class S4143 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4144.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4144.java index 6db28580327..1c5ace142f1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4144.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4144.java @@ -34,6 +34,4 @@ public class S4144 extends Check { public List configurations() { return Collections.singletonList(DEFAULT_THRESHOLD); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4156.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4156.java index 257bc958c64..06c936d5797 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4156.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4156.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4156") -public class S4156 extends Check { - - -} +public class S4156 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4157.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4157.java index 412cf483902..1a1c85c5b03 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4157.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4157.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4157") -public class S4157 extends Check { - - -} +public class S4157 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4158.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4158.java index e2919660dd6..99a8ebd7524 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4158.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4158.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4158") -public class S4158 extends Check { - - -} +public class S4158 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4165.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4165.java index 5918c4361fa..436f8bf9694 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4165.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4165.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4165") -public class S4165 extends Check { - - -} +public class S4165 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4204.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4204.java index 8dd26f92cd2..e4a8e6d4c4e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4204.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4204.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4204") -public class S4204 extends Check { - - -} +public class S4204 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4275.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4275.java index 43381b83824..73efd651896 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4275.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4275.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4275") -public class S4275 extends Check { - - -} +public class S4275 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4322.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4322.java index 555ab551dfb..48453320e23 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4322.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4322.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4322") -public class S4322 extends Check { - - -} +public class S4322 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4323.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4323.java index 8acd2737e14..27290a1b213 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4323.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4323.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4323") -public class S4323 extends Check { - - -} +public class S4323 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4324.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4324.java index 3da026c66c6..a76b9516532 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4324.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4324.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4324") -public class S4324 extends Check { - - -} +public class S4324 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4325.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4325.java index 64905ebcb8f..dbd622c1fc6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4325.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4325.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4325") -public class S4325 extends Check { - - -} +public class S4325 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4326.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4326.java index 6943f6c053b..d60089a2597 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4326.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4326.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4326") -public class S4326 extends Check { - - -} +public class S4326 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4327.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4327.java index 10515b7f79c..97d0a909c54 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4327.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4327.java @@ -31,8 +31,6 @@ public List configurations() { return Collections.singletonList(new Config()); } - - private static class Config { boolean allowDestructuring = true; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4328.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4328.java index cd96c2ad8d2..ba51d01744f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4328.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4328.java @@ -40,16 +40,10 @@ public class S4328 extends Check { @Override public List configurations() { return Collections.singletonList( - new Config( - Arrays.stream(whitelist.split(",")) - .map(String::trim) - .toArray(String[]::new) - ) + new Config(Arrays.stream(whitelist.split(",")).map(String::trim).toArray(String[]::new)) ); } - - private static class Config { String[] whitelist; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4335.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4335.java index b22a9271e27..ae1551d9951 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4335.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4335.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4335") -public class S4335 extends Check { - - -} +public class S4335 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4423.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4423.java index 2cdf9ab88d2..3110439c658 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4423.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4423.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4423") -public class S4423 extends Check { - - -} +public class S4423 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4426.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4426.java index 00471bf05af..2e8a99e3afb 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4426.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4426.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4426") -public class S4426 extends Check { - - -} +public class S4426 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4502.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4502.java index 47f6ff640b1..bbe35b37483 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4502.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4502.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4502") -public class S4502 extends Check { - - -} +public class S4502 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4507.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4507.java index 5fc7f52ea91..bfdd64383e2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4507.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4507.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4507") -public class S4507 extends Check { - - -} +public class S4507 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4524.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4524.java index e697e1f07f7..374c90912c2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4524.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4524.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4524") -public class S4524 extends Check { - - -} +public class S4524 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4619.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4619.java index 374b0ecea8d..928094546b2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4619.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4619.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4619") -public class S4619 extends Check { - - -} +public class S4619 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4621.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4621.java index d84525ef66f..f6cd2239eb6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4621.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4621.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4621") -public class S4621 extends Check { - - -} +public class S4621 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4622.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4622.java index fd44874cc4a..9806cbf282d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4622.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4622.java @@ -38,13 +38,9 @@ public class S4622 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(threshold) - ); + return Collections.singletonList(new Config(threshold)); } - - private static class Config { int threshold; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4623.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4623.java index b74b748b44a..3eea747d0d1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4623.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4623.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4623") -public class S4623 extends Check { - - -} +public class S4623 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4624.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4624.java index 6cc4ea17ed4..54bbd81d053 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4624.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4624.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4624") -public class S4624 extends Check { - - -} +public class S4624 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4634.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4634.java index fbe7e2f9ffa..7c20fe3dba2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4634.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4634.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4634") -public class S4634 extends Check { - - -} +public class S4634 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4721.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4721.java index aa674317a4e..be338adc1a6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4721.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4721.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4721") -public class S4721 extends Check { - - -} +public class S4721 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4782.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4782.java index 9c5128059f9..a84039ba6a4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4782.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4782.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4782") -public class S4782 extends Check { - - -} +public class S4782 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4784.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4784.java index bd826ce500d..4e58f13d598 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4784.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4784.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4784") -public class S4784 extends Check { - - -} +public class S4784 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4787.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4787.java index 1a735d19a03..996d5feff8a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4787.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4787.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4787") -public class S4787 extends Check { - - -} +public class S4787 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4790.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4790.java index 95497db80a8..23f1668a1e0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4790.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4790.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4790") -public class S4790 extends Check { - - -} +public class S4790 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4798.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4798.java index a3decc77622..769df943d96 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4798.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4798.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S4798") -public class S4798 extends Check { - - -} +public class S4798 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4817.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4817.java index 01b2c2a1bc5..c9544d6b632 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4817.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4817.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4817") -public class S4817 extends Check { - - -} +public class S4817 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4818.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4818.java index 1b62452e892..aabc9c4742b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4818.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4818.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4818") -public class S4818 extends Check { - - -} +public class S4818 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4822.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4822.java index 735fa880d2c..2eeb07a284e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4822.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4822.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4822") -public class S4822 extends Check { - - -} +public class S4822 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4823.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4823.java index 3455d1eb9c7..7650d96b2b0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4823.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4823.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4823") -public class S4823 extends Check { - - -} +public class S4823 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4829.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4829.java index 739abedda09..945fc8f93b1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4829.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4829.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4829") -public class S4829 extends Check { - - -} +public class S4829 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4830.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4830.java index 24965198eae..bd564d13d86 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4830.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S4830.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S4830") -public class S4830 extends Check { - - -} +public class S4830 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5042.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5042.java index 5e408b113fe..a71485ad90c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5042.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5042.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5042") -public class S5042 extends Check { - - -} +public class S5042 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5122.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5122.java index 8041448d99a..c7df7ec0504 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5122.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5122.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5122") -public class S5122 extends Check { - - -} +public class S5122 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5148.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5148.java index 77199f50165..7f90cd26a4e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5148.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5148.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5148") -public class S5148 extends Check { - - -} +public class S5148 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5247.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5247.java index 8c3cd7fee9c..6e2c3fc8d49 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5247.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5247.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5247") -public class S5247 extends Check { - - -} +public class S5247 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5254.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5254.java index bccb1bb3510..c55d96c16ab 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5254.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5254.java @@ -26,7 +26,4 @@ @JavaScriptRule @DeprecatedRuleKey(ruleKey = "S6849") @Rule(key = "S5254") -public class S5254 extends Check { - - -} +public class S5254 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5256.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5256.java index f0377f3da2b..dfccf1ea417 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5256.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5256.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5256") -public class S5256 extends Check { - - -} +public class S5256 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5257.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5257.java index 15599be1dab..bbd3159015b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5257.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5257.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S5257") -public class S5257 extends Check { - - -} +public class S5257 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5260.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5260.java index e278f6d4ef1..1f137ef4866 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5260.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5260.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5260") -public class S5260 extends Check { - - -} +public class S5260 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5264.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5264.java index 77e6e1e794a..2eaed2afc08 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5264.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5264.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S5264") -public class S5264 extends Check { - - -} +public class S5264 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5332.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5332.java index 35b5602ce85..1841b3f5e76 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5332.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5332.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5332") -public class S5332 extends Check { - - -} +public class S5332 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5443.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5443.java index b78e627cd5d..ad8999c9f5f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5443.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5443.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5443") -public class S5443 extends Check { - - -} +public class S5443 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5527.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5527.java index b718f02652f..179e3b322ac 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5527.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5527.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5527") -public class S5527 extends Check { - - -} +public class S5527 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5542.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5542.java index d2405756c33..60af4818f3c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5542.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5542.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5542") -public class S5542 extends Check { - - -} +public class S5542 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5547.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5547.java index d47261ff534..1631fa4c516 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5547.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5547.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5547") -public class S5547 extends Check { - - -} +public class S5547 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5604.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5604.java index 3d40ae13c13..2e6f8d3f712 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5604.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5604.java @@ -43,14 +43,10 @@ public class S5604 extends Check { @Override public List configurations() { return Collections.singletonList( - new Config( - Arrays.stream(permissions.split(",")).map(String::trim).toArray(String[]::new) - ) + new Config(Arrays.stream(permissions.split(",")).map(String::trim).toArray(String[]::new)) ); } - - private static class Config { String[] permissions; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5659.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5659.java index 2d876bb370d..80181c4d958 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5659.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5659.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5659") -public class S5659 extends Check { - - -} +public class S5659 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5689.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5689.java index a63792174e1..604f2cfcebd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5689.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5689.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5689") -public class S5689 extends Check { - - -} +public class S5689 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5691.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5691.java index 8aebc0257d7..58559befc71 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5691.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5691.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5691") -public class S5691 extends Check { - - -} +public class S5691 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5693.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5693.java index 84de1a483d2..3325922a2dd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5693.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5693.java @@ -28,6 +28,7 @@ @TypeScriptRule @Rule(key = "S5693") public class S5693 extends Check { + private static final int DEFAULT_FILE_UPLOAD_SIZE_LIMIT = 8_000_000; private static final int DEFAULT_STANDARD_SIZE_LIMIT = 2_000_000; @@ -38,7 +39,6 @@ public class S5693 extends Check { ) long fileUploadSizeLimit = DEFAULT_FILE_UPLOAD_SIZE_LIMIT; - @RuleProperty( key = "standardSizeLimit", description = "The maximum size of regular HTTP requests (in bytes)", @@ -48,14 +48,11 @@ public class S5693 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(fileUploadSizeLimit, standardSizeLimit) - ); + return Collections.singletonList(new Config(fileUploadSizeLimit, standardSizeLimit)); } - - private static class Config { + long fileUploadSizeLimit; long standardSizeLimit; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5725.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5725.java index 66e249c9491..e495abf4043 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5725.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5725.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5725") -public class S5725 extends Check { - - -} +public class S5725 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5728.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5728.java index f6879bcb499..2efbd678d04 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5728.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5728.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5728") -public class S5728 extends Check { - - -} +public class S5728 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5730.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5730.java index 3e84eb8e20c..565f8f844f5 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5730.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5730.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5730") -public class S5730 extends Check { - - -} +public class S5730 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5732.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5732.java index f6c20a0af63..a37fdbccd95 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5732.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5732.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5732") -public class S5732 extends Check { - - -} +public class S5732 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5734.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5734.java index a5af22e17ef..d222d80e2e5 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5734.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5734.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5734") -public class S5734 extends Check { - - -} +public class S5734 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5736.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5736.java index b7104ee5550..5d281f85bc3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5736.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5736.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5736") -public class S5736 extends Check { - - -} +public class S5736 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5739.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5739.java index f3621fdd447..53a02bc27bf 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5739.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5739.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5739") -public class S5739 extends Check { - - -} +public class S5739 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5742.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5742.java index d05840850f2..26f90b04069 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5742.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5742.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5742") -public class S5742 extends Check { - - -} +public class S5742 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5743.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5743.java index bf9f8dc28b3..2dacb9183f4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5743.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5743.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5743") -public class S5743 extends Check { - - -} +public class S5743 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5757.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5757.java index 51379654efc..f51ba78487a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5757.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5757.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5757") -public class S5757 extends Check { - - -} +public class S5757 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5759.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5759.java index 89fe1234892..0cda3bf4af4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5759.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5759.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5759") -public class S5759 extends Check { - - -} +public class S5759 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5842.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5842.java index cd4be0b7404..cf53c827874 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5842.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5842.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5842") -public class S5842 extends Check { - - -} +public class S5842 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5843.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5843.java index 9533ce924b3..3d2b2656a6b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5843.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5843.java @@ -40,13 +40,9 @@ public class S5843 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(threshold) - ); + return Collections.singletonList(new Config(threshold)); } - - private static class Config { int threshold; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5850.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5850.java index 4451b751064..dfac87f99d9 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5850.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5850.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5850") -public class S5850 extends Check { - - -} +public class S5850 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5852.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5852.java index 9a472de122f..c45351ebe53 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5852.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5852.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S5852") -public class S5852 extends Check { - - -} +public class S5852 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5856.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5856.java index 8a156c90720..96dd65cc4ec 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5856.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5856.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5856") -public class S5856 extends Check { - - -} +public class S5856 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5860.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5860.java index 6183440ecbe..db6215412c6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5860.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5860.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5860") -public class S5860 extends Check { - - -} +public class S5860 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5863.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5863.java index ad7dc7b3d53..728fce7e3e1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5863.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5863.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S5863") -public class S5863 extends TestFileCheck { - - -} +public class S5863 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5867.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5867.java index e77a7818d6b..53cb5e21f34 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5867.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5867.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5867") -public class S5867 extends Check { - - -} +public class S5867 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5868.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5868.java index 368de69edae..fa2055bec71 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5868.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5868.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S5868") -public class S5868 extends Check { - - -} +public class S5868 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5869.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5869.java index 46a1fb05360..8b3d6a43d3b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5869.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5869.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S5869") -public class S5869 extends Check { - - -} +public class S5869 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5876.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5876.java index f1ce1212eaa..963cea034e1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5876.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5876.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S5876") -public class S5876 extends Check { - - -} +public class S5876 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5958.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5958.java index 612b670363c..11da4fba5aa 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5958.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5958.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S5958") -public class S5958 extends TestFileCheck { - - -} +public class S5958 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5973.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5973.java index 0242c077d10..0b05be037d7 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5973.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S5973.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S5973") -public class S5973 extends TestFileCheck { - - -} +public class S5973 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6019.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6019.java index aa97a71c416..f2512a7235c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6019.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6019.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6019") -public class S6019 extends Check { - - -} +public class S6019 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6035.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6035.java index 86661c45ea2..72dfcaa51a9 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6035.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6035.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6035") -public class S6035 extends Check { - - -} +public class S6035 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6079.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6079.java index d81019fb364..86c889b19ce 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6079.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6079.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6079") -public class S6079 extends TestFileCheck { - - -} +public class S6079 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6080.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6080.java index 4a425cc22df..a141d2754da 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6080.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6080.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6080") -public class S6080 extends TestFileCheck { - - -} +public class S6080 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6092.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6092.java index 57f00e578b5..c748056033f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6092.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6092.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6092") -public class S6092 extends TestFileCheck { - - -} +public class S6092 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6245.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6245.java index ebbf6482de0..775f0284cbe 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6245.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6245.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6245") -public class S6245 extends Check { - - -} +public class S6245 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6249.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6249.java index e3e36367608..a4c328b7180 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6249.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6249.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6249") -public class S6249 extends Check { - - -} +public class S6249 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6252.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6252.java index 2a90576fc0b..c6564afde92 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6252.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6252.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6252") -public class S6252 extends Check { - - -} +public class S6252 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6265.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6265.java index d859a98d715..2e386deb033 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6265.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6265.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6265") -public class S6265 extends Check { - - -} +public class S6265 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6268.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6268.java index de40aac7832..14bf900a90e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6268.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6268.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6268") -public class S6268 extends Check { - - -} +public class S6268 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6270.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6270.java index 157b728e343..9424445f4ce 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6270.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6270.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6270") -public class S6270 extends Check { - - -} +public class S6270 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6275.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6275.java index fcdc47156ac..7e7aa843f7e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6275.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6275.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6275") -public class S6275 extends Check { - - -} +public class S6275 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6281.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6281.java index ef2d80bde13..bf068b924a0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6281.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6281.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6281") -public class S6281 extends Check { - - -} +public class S6281 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6299.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6299.java index e05d621612a..915e8e0c687 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6299.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6299.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6299") -public class S6299 extends Check { - - -} +public class S6299 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6302.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6302.java index 7d5067de6c8..abdbfcd3dbd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6302.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6302.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6302") -public class S6302 extends Check { - - -} +public class S6302 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6303.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6303.java index e05e42c5c22..7c37ebcfbad 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6303.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6303.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6303") -public class S6303 extends Check { - - -} +public class S6303 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6304.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6304.java index d457dd86dcd..c142b1a7b65 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6304.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6304.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6304") -public class S6304 extends Check { - - -} +public class S6304 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6308.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6308.java index 7a8e43b4584..a52c922255c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6308.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6308.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6308") -public class S6308 extends Check { - - -} +public class S6308 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6317.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6317.java index 319e89b4881..5714c5df036 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6317.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6317.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6317") -public class S6317 extends Check { - - -} +public class S6317 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6319.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6319.java index 0866074a455..aa33180b2d3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6319.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6319.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6319") -public class S6319 extends Check { - - -} +public class S6319 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6321.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6321.java index c1326dfeb77..c40aae11b18 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6321.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6321.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6321") -public class S6321 extends Check { - - -} +public class S6321 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6323.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6323.java index 996cafbe83a..c8fa5bda01e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6323.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6323.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6323") -public class S6323 extends Check { - - -} +public class S6323 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6324.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6324.java index df245a8f1e3..ad529a5f1e4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6324.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6324.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6324") -public class S6324 extends Check { - - -} +public class S6324 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6325.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6325.java index 29871113480..453d0b435f0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6325.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6325.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6325") -public class S6325 extends Check { - - -} +public class S6325 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6326.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6326.java index a7e404a4358..49321e5ad60 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6326.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6326.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6326") -public class S6326 extends Check { - - -} +public class S6326 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6327.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6327.java index cd32feaddf9..4b94a0ddfd7 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6327.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6327.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6327") -public class S6327 extends Check { - - -} +public class S6327 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6328.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6328.java index a878f13813b..1ac54882594 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6328.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6328.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6328") -public class S6328 extends Check { - - -} +public class S6328 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6329.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6329.java index 39f93315da7..0f77609962a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6329.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6329.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6329") -public class S6329 extends Check { - - -} +public class S6329 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6330.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6330.java index a9e4527ce9a..db4accaf66d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6330.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6330.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6330") -public class S6330 extends Check { - - -} +public class S6330 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6331.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6331.java index 0bfd06886ef..bb73229703d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6331.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6331.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6331") -public class S6331 extends Check { - - -} +public class S6331 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6332.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6332.java index 112cd6028ca..c28933d79aa 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6332.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6332.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6332") -public class S6332 extends Check { - - -} +public class S6332 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6333.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6333.java index 7c3ec86a187..45695d07c50 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6333.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6333.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6333") -public class S6333 extends Check { - - -} +public class S6333 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6351.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6351.java index 46e25bdce48..ca88aaff719 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6351.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6351.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6351") -public class S6351 extends Check { - - -} +public class S6351 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6353.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6353.java index e6f481944c5..4b628260cb1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6353.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6353.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6353") -public class S6353 extends Check { - - -} +public class S6353 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6397.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6397.java index 421c7ef0817..af633c9891b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6397.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6397.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6397") -public class S6397 extends Check { - - -} +public class S6397 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6418.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6418.java index 1bc0d9ec570..3ffb8736bd8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6418.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6418.java @@ -38,6 +38,7 @@ public class S6418 extends Check { defaultValue = DEFAULT_SECRET_WORDS ) public String secretWords = DEFAULT_SECRET_WORDS; + @RuleProperty( key = "randomnessSensibility", description = "Minimum shannon entropy threshold of the secret", @@ -47,9 +48,7 @@ public class S6418 extends Check { @Override public List configurations() { - return Collections.singletonList( - new Config(secretWords, randomnessSensibility) - ); + return Collections.singletonList(new Config(secretWords, randomnessSensibility)); } private static class Config { diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6426.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6426.java index 08334c6e338..4504eeb41d3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6426.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6426.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6426") -public class S6426 extends TestFileCheck { - - -} +public class S6426 extends TestFileCheck {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6435.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6435.java index b217d30c2a8..0fc1472231c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6435.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6435.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6435") -public class S6435 extends Check { - - -} +public class S6435 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6438.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6438.java index 1242d5f37a3..b5a842cbe43 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6438.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6438.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6438") -public class S6438 extends Check { - - -} +public class S6438 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6439.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6439.java index 1c19e38291c..416f65d5f21 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6439.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6439.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6439") -public class S6439 extends Check { - - -} +public class S6439 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6440.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6440.java index 284aba848f6..7862a0ca153 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6440.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6440.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6440") -public class S6440 extends Check { - - -} +public class S6440 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6441.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6441.java index 69d3fc10636..a5d6933758f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6441.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6441.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6441") -public class S6441 extends Check { - - -} +public class S6441 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6442.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6442.java index 8eab2560712..284786a33e8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6442.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6442.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6442") -public class S6442 extends Check { - - -} +public class S6442 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6443.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6443.java index d2591da7b19..108a66a48a8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6443.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6443.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6443") -public class S6443 extends Check { - - -} +public class S6443 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6477.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6477.java index 83ddf68fba2..65f0c51e46f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6477.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6477.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6477") -public class S6477 extends Check { - - -} +public class S6477 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6478.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6478.java index 6a30cf6e677..f3b28a99be4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6478.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6478.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6478") -public class S6478 extends Check { - - -} +public class S6478 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6479.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6479.java index b3fbfe555d8..a232a25ccc9 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6479.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6479.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6479") -public class S6479 extends Check { - - -} +public class S6479 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6480.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6480.java index 273cefc7928..71f0b3bbc51 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6480.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6480.java @@ -27,8 +27,6 @@ @Rule(key = "S6480") public class S6480 extends Check { - - @Override public List configurations() { return List.of(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6481.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6481.java index 34993fa67ec..15b269993de 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6481.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6481.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6481") -public class S6481 extends Check { - - -} +public class S6481 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6486.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6486.java index b476a6c1899..c43af7b01e4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6486.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6486.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6486") -public class S6486 extends Check { - - -} +public class S6486 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6509.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6509.java index b99dbdb24c0..9e4334cbd13 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6509.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6509.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6509") -public class S6509 extends Check { - - -} +public class S6509 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6522.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6522.java index 841a239d160..2f0b692fd1e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6522.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6522.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6522") -public class S6522 extends Check { - - -} +public class S6522 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6523.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6523.java index 6b5e5be0f94..9256edfa224 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6523.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6523.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6523") -public class S6523 extends Check { - - -} +public class S6523 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6534.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6534.java index 5255b8625ae..7009f1c5d7c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6534.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6534.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6534") -public class S6534 extends Check { - - -} +public class S6534 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6535.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6535.java index 9255c6806ff..5a808bace01 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6535.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6535.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6535") -public class S6535 extends Check { - - -} +public class S6535 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6544.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6544.java index 702aed3a8b4..e251ce58f10 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6544.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6544.java @@ -45,6 +45,4 @@ private static class ChecksVoidReturn { public List configurations() { return Collections.singletonList(new Config()); } - - } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6550.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6550.java index 361e267cf30..2235ada68e2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6550.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6550.java @@ -30,8 +30,6 @@ public List configurations() { return List.of(new Config()); } - - private static class Config { // Option to allow bitwise expressions in enum initializers (Default: false). diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6551.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6551.java index 83d3206f167..4e399957bf6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6551.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6551.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6551") -public class S6551 extends Check { - - -} +public class S6551 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6557.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6557.java index 8886454ab02..8df4ee36905 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6557.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6557.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6557") -public class S6557 extends Check { - - -} +public class S6557 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6564.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6564.java index f4f3d5d603b..9e1c1d91d60 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6564.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6564.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6564") -public class S6564 extends Check { - - -} +public class S6564 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6565.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6565.java index 837c48dce5c..51e62633252 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6565.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6565.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6565") -public class S6565 extends Check { - - -} +public class S6565 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6568.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6568.java index 3e4a0c0a44f..72ec4a6ae31 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6568.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6568.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6568") -public class S6568 extends Check { - - -} +public class S6568 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6569.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6569.java index b9dae9c2ca7..2b649af301c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6569.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6569.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6569") -public class S6569 extends Check { - - -} +public class S6569 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6571.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6571.java index 0707f49faf7..7b33b1d7c86 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6571.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6571.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6571") -public class S6571 extends Check { - - -} +public class S6571 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6572.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6572.java index 88ce23e5234..d348eeb7f02 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6572.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6572.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6572") -public class S6572 extends Check { - - -} +public class S6572 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6578.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6578.java index 52202b19a72..63ba0d9c85a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6578.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6578.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6578") -public class S6578 extends Check { - - -} +public class S6578 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6582.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6582.java index b4949ceb298..0fc0163f6e3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6582.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6582.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6582") -public class S6582 extends Check { - - -} +public class S6582 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6583.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6583.java index 583f179a94d..d140ae9d7f4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6583.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6583.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6583") -public class S6583 extends Check { - - -} +public class S6583 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6590.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6590.java index 9495fd3cd94..74a3d99b737 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6590.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6590.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6590") -public class S6590 extends Check { - - -} +public class S6590 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6594.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6594.java index 434e8960f07..847356fce48 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6594.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6594.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6594") -public class S6594 extends Check { - - -} +public class S6594 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6598.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6598.java index e579309ade3..fb4312c69f0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6598.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6598.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6598") -public class S6598 extends Check { - - -} +public class S6598 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6606.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6606.java index 07a51b2bdf2..f0e019bddd6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6606.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6606.java @@ -31,8 +31,6 @@ public List configurations() { return Collections.singletonList(new Config()); } - - private static class Config { boolean ignoreConditionalTests = true; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6627.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6627.java index b341b301d6c..2fefbd903e4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6627.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6627.java @@ -24,6 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6627") -public class S6627 extends Check { - -} +public class S6627 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6635.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6635.java index fc4d6391d9b..2651ab36525 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6635.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6635.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6635") -public class S6635 extends Check { - - -} +public class S6635 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6637.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6637.java index f0f698ca725..00f3a9c4639 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6637.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6637.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6637") -public class S6637 extends Check { - - -} +public class S6637 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6638.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6638.java index f5cae42a762..89367096de7 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6638.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6638.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6638") -public class S6638 extends Check { - - -} +public class S6638 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6643.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6643.java index 32bd4128421..3e08b4ebb2a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6643.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6643.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6643") -public class S6643 extends Check { - - -} +public class S6643 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6644.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6644.java index 4d3e3b60ee4..f1e4afa91c8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6644.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6644.java @@ -28,8 +28,6 @@ @Rule(key = "S6644") public class S6644 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6645.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6645.java index 922a12986d7..214f5f4eaf7 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6645.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6645.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S6645") -public class S6645 extends Check { - - -} +public class S6645 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6647.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6647.java index 1ecba6e769d..45e47ad7843 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6647.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6647.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6647") -public class S6647 extends Check { - - -} +public class S6647 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6650.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6650.java index aeb505f062b..6d73b03cae6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6650.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6650.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6650") -public class S6650 extends Check { - - -} +public class S6650 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6653.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6653.java index 430a7b550bb..0588ab20673 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6653.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6653.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6653") -public class S6653 extends Check { - - -} +public class S6653 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6654.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6654.java index 0b7f9fdd795..4ea7734d5ae 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6654.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6654.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6654") -public class S6654 extends Check { - - -} +public class S6654 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6657.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6657.java index 7c657142d53..70ad3f6ed6f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6657.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6657.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6657") -public class S6657 extends Check { - - -} +public class S6657 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6660.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6660.java index 0c4c677d5d3..0cbe14ae499 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6660.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6660.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6660") -public class S6660 extends Check { - - -} +public class S6660 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6661.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6661.java index 233ac89a9be..235ccf4188e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6661.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6661.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6661") -public class S6661 extends Check { - - -} +public class S6661 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6666.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6666.java index 990cbc01a83..7cc8423fd3d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6666.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6666.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6666") -public class S6666 extends Check { - - -} +public class S6666 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6671.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6671.java index a43606dcd46..291fa7b3de9 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6671.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6671.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6671") -public class S6671 extends Check { - - -} +public class S6671 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6676.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6676.java index bce65e48ee1..57ee9980726 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6676.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6676.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6676") -public class S6676 extends Check { - - -} +public class S6676 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6679.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6679.java index 27a18f30249..babcdc364b4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6679.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6679.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6679") -public class S6679 extends Check { - - -} +public class S6679 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6746.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6746.java index b1f8ff8b11a..f3933aec619 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6746.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6746.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6746") -public class S6746 extends Check { - - -} +public class S6746 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6747.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6747.java index 7865ce1b52f..2ee433c82fc 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6747.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6747.java @@ -44,8 +44,6 @@ public List configurations() { ); } - - private static class Config { List ignore; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6748.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6748.java index ba4750c78a0..cf27a2e28a2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6748.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6748.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6748") -public class S6748 extends Check { - - -} +public class S6748 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6749.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6749.java index 7fc2a7cf19b..6e791edd76d 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6749.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6749.java @@ -27,8 +27,6 @@ @Rule(key = "S6749") public class S6749 extends Check { - - @Override public List configurations() { return List.of(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6750.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6750.java index 617897ed004..6a704c91631 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6750.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6750.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6750") -public class S6750 extends Check { - - -} +public class S6750 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6754.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6754.java index d2fb712ba26..dd9bc04110a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6754.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6754.java @@ -28,8 +28,6 @@ @Rule(key = "S6754") public class S6754 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6756.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6756.java index 888a247b10f..7eceaa64b5e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6756.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6756.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6756") -public class S6756 extends Check { - - -} +public class S6756 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6757.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6757.java index f9c830d5256..0c7ddc86b80 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6757.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6757.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6757") -public class S6757 extends Check { - - -} +public class S6757 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6759.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6759.java index 9ecf82cc129..0388abecf33 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6759.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6759.java @@ -22,7 +22,4 @@ @TypeScriptRule @Rule(key = "S6759") -public class S6759 extends Check { - - -} +public class S6759 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6761.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6761.java index 479dc704ba5..5100339b2d3 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6761.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6761.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6761") -public class S6761 extends Check { - - -} +public class S6761 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6763.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6763.java index 3e8d1bb65a3..ddb5a6bf725 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6763.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6763.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6763") -public class S6763 extends Check { - - -} +public class S6763 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6766.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6766.java index 726436dcbc8..13e13b4f6b8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6766.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6766.java @@ -28,8 +28,6 @@ @Rule(key = "S6766") public class S6766 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6767.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6767.java index 855b15d5601..fe07b523b29 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6767.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6767.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6767") -public class S6767 extends Check { - - -} +public class S6767 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6770.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6770.java index 1f9b843a0ac..5ebc2f725c8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6770.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6770.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6770") -public class S6770 extends Check { - - -} +public class S6770 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6772.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6772.java index 190b5e047fa..f1b72741f25 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6772.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6772.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6772") -public class S6772 extends Check { - - -} +public class S6772 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6774.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6774.java index e9bf67f748d..fca73f83bc1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6774.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6774.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S6774") -public class S6774 extends Check { - - -} +public class S6774 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6775.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6775.java index 77f3b9c76a1..d7572fafd08 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6775.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6775.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6775") -public class S6775 extends Check { - - -} +public class S6775 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6788.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6788.java index 0e18538415d..423e69169c5 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6788.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6788.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6788") -public class S6788 extends Check { - - -} +public class S6788 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6789.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6789.java index df06552f5b3..022289af5fd 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6789.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6789.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6789") -public class S6789 extends Check { - - -} +public class S6789 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6790.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6790.java index 7ebcc5dd8da..7dad1905f4a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6790.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6790.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6790") -public class S6790 extends Check { - - -} +public class S6790 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6791.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6791.java index 0b7cd38a6e9..944e1ab8842 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6791.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6791.java @@ -28,8 +28,6 @@ @Rule(key = "S6791") public class S6791 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6793.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6793.java index b6982900825..f21243b0f2b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6793.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6793.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6793") -public class S6793 extends Check { - - -} +public class S6793 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6807.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6807.java index a2f0bb643c8..a9c7673330f 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6807.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6807.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6807") -public class S6807 extends Check { - - -} +public class S6807 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6811.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6811.java index 82b4600c243..7bd8ac61d29 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6811.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6811.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6811") -public class S6811 extends Check { - - -} +public class S6811 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6819.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6819.java index 4feabff96a3..d00be2b5797 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6819.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6819.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6819") -public class S6819 extends Check { - - -} +public class S6819 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6821.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6821.java index 4b371dd7d27..fab0c2f3c86 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6821.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6821.java @@ -28,8 +28,6 @@ @Rule(key = "S6821") public class S6821 extends Check { - - @Override public List configurations() { return Collections.singletonList(new Config()); diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6822.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6822.java index 5ee9191d71a..4ea31f9a212 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6822.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6822.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6822") -public class S6822 extends Check { - - -} +public class S6822 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6823.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6823.java index 3bfd0710350..f6103ec3b70 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6823.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6823.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6823") -public class S6823 extends Check { - - -} +public class S6823 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6824.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6824.java index 4e3c3eacfc0..d7155befe79 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6824.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6824.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6824") -public class S6824 extends Check { - - -} +public class S6824 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6825.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6825.java index b9206918ac1..ed1656d3ea4 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6825.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6825.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6825") -public class S6825 extends Check { - - -} +public class S6825 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6827.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6827.java index 67e7435df79..f51c9583f12 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6827.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6827.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6827") -public class S6827 extends Check { - - -} +public class S6827 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6836.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6836.java index dbe4e87c73b..4b085ab562e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6836.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6836.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6836") -public class S6836 extends Check { - - -} +public class S6836 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6840.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6840.java index 85292dc1217..565ee1fe2c6 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6840.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6840.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6840") -public class S6840 extends Check { - - -} +public class S6840 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6841.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6841.java index 2c4e8df2471..88da61d829a 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6841.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6841.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6841") -public class S6841 extends Check { - - -} +public class S6841 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6842.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6842.java index decd15979be..6e7d759c123 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6842.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6842.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6842") -public class S6842 extends Check { - - -} +public class S6842 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6843.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6843.java index 8e55256e886..e36d10bc6d1 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6843.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6843.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6843") -public class S6843 extends Check { - - -} +public class S6843 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6844.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6844.java index 00870604a1a..06fc14deb60 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6844.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6844.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6844") -public class S6844 extends Check { - - -} +public class S6844 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6845.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6845.java index e5c6720902b..4fc351ec46c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6845.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6845.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6845") -public class S6845 extends Check { - - -} +public class S6845 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6846.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6846.java index 015d27c3efb..0e9111428a2 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6846.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6846.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6846") -public class S6846 extends Check { - - -} +public class S6846 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6847.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6847.java index 783be2e0f95..ab4cce18a11 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6847.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6847.java @@ -18,7 +18,6 @@ import java.util.Collections; import java.util.List; - import org.sonar.check.Rule; import org.sonar.plugins.javascript.api.Check; import org.sonar.plugins.javascript.api.JavaScriptRule; @@ -35,6 +34,14 @@ public List configurations() { } private static class Config { - String[] handlers = {"onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"}; + + String[] handlers = { + "onClick", + "onMouseDown", + "onMouseUp", + "onKeyPress", + "onKeyDown", + "onKeyUp", + }; } } diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6848.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6848.java index 9a1b1c6a424..3897688759c 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6848.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6848.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6848") -public class S6848 extends Check { - - -} +public class S6848 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6850.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6850.java index 592e12752fb..47400998733 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6850.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6850.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6850") -public class S6850 extends Check { - - -} +public class S6850 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6851.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6851.java index 54e4e5b06c6..31225e10d27 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6851.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6851.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6851") -public class S6851 extends Check { - - -} +public class S6851 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6852.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6852.java index a5169683d85..dc040da9403 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6852.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6852.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6852") -public class S6852 extends Check { - - -} +public class S6852 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6853.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6853.java index 26188c2e326..7bf17e4e3db 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6853.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6853.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6853") -public class S6853 extends Check { - - -} +public class S6853 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6859.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6859.java index 6c6344a1069..a2b22754e1b 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6859.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6859.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6859") -public class S6859 extends Check { - - -} +public class S6859 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6861.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6861.java index 4b4d9490692..9c1f18e9225 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6861.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6861.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S6861") -public class S6861 extends Check { - - -} +public class S6861 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6957.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6957.java index c1729f7022b..13365aa7592 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6957.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6957.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6957") -public class S6957 extends Check { - - -} +public class S6957 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6958.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6958.java index ebf3cd3a8d1..dd9f38d9c15 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6958.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6958.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6958") -public class S6958 extends Check { - - -} +public class S6958 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6959.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6959.java index 839c85252c8..3d66b096b94 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6959.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S6959.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S6959") -public class S6959 extends Check { - - -} +public class S6959 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S7059.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S7059.java index 49b6d39fc73..a4a550f6044 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S7059.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S7059.java @@ -24,5 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S7059") -public class S7059 extends Check { -} +public class S7059 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S7060.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S7060.java index a74d52f5434..925b849a2e0 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S7060.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S7060.java @@ -24,6 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S7060") -public class S7060 extends Check { - -} +public class S7060 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S878.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S878.java index cfd6c30eb81..0ba4ba44d9e 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S878.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S878.java @@ -24,7 +24,4 @@ @TypeScriptRule @JavaScriptRule @Rule(key = "S878") -public class S878 extends Check { - - -} +public class S878 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S881.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S881.java index 465d9097d4b..10b91732259 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S881.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S881.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S881") -public class S881 extends Check { - - -} +public class S881 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S888.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S888.java index b27f6651c28..1a4da5d7d38 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S888.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S888.java @@ -24,7 +24,4 @@ @JavaScriptRule @TypeScriptRule @Rule(key = "S888") -public class S888 extends Check { - - -} +public class S888 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S905.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S905.java index 34ef1332fd8..6fa6c2ef084 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S905.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S905.java @@ -33,8 +33,6 @@ public List configurations() { return Collections.singletonList(new Config()); } - - private static class Config { boolean allowShortCircuit = true; diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S909.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S909.java index 1dd0064b363..930240329e8 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S909.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S909.java @@ -26,7 +26,4 @@ @TypeScriptRule @Rule(key = "S909") @DeprecatedRuleKey(ruleKey = "ContinueStatement") -public class S909 extends Check { - - -} +public class S909 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S930.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S930.java index 66d507412b7..5d8394d2efc 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S930.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S930.java @@ -22,7 +22,4 @@ @JavaScriptRule @Rule(key = "S930") -public class S930 extends Check { - - -} +public class S930 extends Check {} diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/CheckListTest.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/CheckListTest.java index 3bc9b9b2202..90884d0e24c 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/CheckListTest.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/CheckListTest.java @@ -38,8 +38,7 @@ class CheckListTest { */ @Test void count() throws Exception { - long count = Files - .list(Paths.get("src/main/java/org/sonar/javascript/checks/")) + long count = Files.list(Paths.get("src/main/java/org/sonar/javascript/checks/")) .filter(p -> p.getFileName().toString().matches("S\\d+(Js|Ts)?\\.java")) .count(); assertThat(CheckList.getAllChecks()).hasSize((int) count); diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S106Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S106Test.java index f34148145f4..ad6dd743e38 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S106Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S106Test.java @@ -26,9 +26,8 @@ class S106Test { @Test void configurations() { String configAsString = new Gson().toJson(new S106().configurations()); - assertThat(configAsString) - .isEqualTo( - "[{\"allow\":[\"assert\",\"clear\",\"count\",\"group\",\"groupCollapsed\",\"groupEnd\",\"info\",\"table\",\"time\",\"timeEnd\",\"trace\"]}]" - ); + assertThat(configAsString).isEqualTo( + "[{\"allow\":[\"assert\",\"clear\",\"count\",\"group\",\"groupCollapsed\",\"groupEnd\",\"info\",\"table\",\"time\",\"timeEnd\",\"trace\"]}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S109Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S109Test.java index f0a39a18d51..5dc5edc2541 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S109Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S109Test.java @@ -26,9 +26,8 @@ class S109Test { @Test void config() { String configAsString = new Gson().toJson(new S109().configurations()); - assertThat(configAsString) - .isEqualTo( - "[{\"ignore\":[0,1,-1,24,60],\"ignoreEnums\":true,\"ignoreReadonlyClassProperties\":true,\"ignoreNumericLiteralTypes\":true,\"ignoreDefaultValues\":true,\"ignoreClassFieldInitialValues\":true}]" - ); + assertThat(configAsString).isEqualTo( + "[{\"ignore\":[0,1,-1,24,60],\"ignoreEnums\":true,\"ignoreReadonlyClassProperties\":true,\"ignoreNumericLiteralTypes\":true,\"ignoreDefaultValues\":true,\"ignoreClassFieldInitialValues\":true}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1117Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1117Test.java index 4c3777b8909..14614f2f087 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1117Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1117Test.java @@ -25,7 +25,6 @@ class S1117Test { @Test void test() { - assertThat(new Gson().toJson(new S1117().configurations())) - .isEqualTo("[{\"hoist\":\"all\"}]"); + assertThat(new Gson().toJson(new S1117().configurations())).isEqualTo("[{\"hoist\":\"all\"}]"); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S117Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S117Test.java index 1c6ade5eaf9..5e489fb3d7e 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S117Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S117Test.java @@ -29,8 +29,9 @@ void configurations() { // default configuration String defaultConfigAsString = new Gson().toJson(check.configurations()); - assertThat(defaultConfigAsString) - .isEqualTo("[{\"format\":\"^[_$A-Za-z][$A-Za-z0-9]*$|^[_$A-Z][_$A-Z0-9]+$\"}]"); + assertThat(defaultConfigAsString).isEqualTo( + "[{\"format\":\"^[_$A-Za-z][$A-Za-z0-9]*$|^[_$A-Z][_$A-Z0-9]+$\"}]" + ); // custom configuration check.format = "^[a-zA-Z0-9]*$"; diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1186Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1186Test.java index 6b30a0d28ce..a4f793aebd0 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1186Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1186Test.java @@ -26,7 +26,8 @@ class S1186Test { @Test void configurations() { String configAsString = new Gson().toJson(new S1186().configurations()); - assertThat(configAsString) - .isEqualTo("[{\"allow\":[\"arrowFunctions\",\"constructors\",\"private-constructors\"]}]"); + assertThat(configAsString).isEqualTo( + "[{\"allow\":[\"arrowFunctions\",\"constructors\",\"private-constructors\"]}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1192Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1192Test.java index 58577ce59ee..7577212cb67 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1192Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1192Test.java @@ -27,8 +27,9 @@ class S1192Test { void configurations() { // default configuration String configAsString = new Gson().toJson(new S1192().configurations()); - assertThat(configAsString) - .isEqualTo("[{\"threshold\":3,\"ignoreStrings\":\"application/json\"}]"); + assertThat(configAsString).isEqualTo( + "[{\"threshold\":3,\"ignoreStrings\":\"application/json\"}]" + ); // custom configuration S1192 noDuplicateStringCheck = new S1192(); noDuplicateStringCheck.threshold = 10; diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S124Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S124Test.java index ba0b10a9bb3..95970f92cfd 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S124Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S124Test.java @@ -28,29 +28,27 @@ void test_configuration() { S124 check = new S124(); String defaultConfigAsString = new Gson().toJson(check.configurations()); - assertThat(defaultConfigAsString) - .isEqualTo( - "[{\"regularExpression\":\"\",\"message\":\"The regular expression matches this comment.\",\"flags\":\"\"}]" - ); + assertThat(defaultConfigAsString).isEqualTo( + "[{\"regularExpression\":\"\",\"message\":\"The regular expression matches this comment.\",\"flags\":\"\"}]" + ); check.message = "This is a message"; String configAsString = new Gson().toJson(check.configurations()); - assertThat(configAsString) - .isEqualTo("[{\"regularExpression\":\"\",\"message\":\"This is a message\",\"flags\":\"\"}]"); + assertThat(configAsString).isEqualTo( + "[{\"regularExpression\":\"\",\"message\":\"This is a message\",\"flags\":\"\"}]" + ); check.regularExpression = "[a-z]"; String configAsString2 = new Gson().toJson(check.configurations()); - assertThat(configAsString2) - .isEqualTo( - "[{\"regularExpression\":\"[a-z]\",\"message\":\"This is a message\",\"flags\":\"\"}]" - ); + assertThat(configAsString2).isEqualTo( + "[{\"regularExpression\":\"[a-z]\",\"message\":\"This is a message\",\"flags\":\"\"}]" + ); check.flags = "iu"; - assertThat(new Gson().toJson(check.configurations())) - .isEqualTo( - "[{\"regularExpression\":\"[a-z]\",\"message\":\"This is a message\",\"flags\":\"iu\"}]" - ); + assertThat(new Gson().toJson(check.configurations())).isEqualTo( + "[{\"regularExpression\":\"[a-z]\",\"message\":\"This is a message\",\"flags\":\"iu\"}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1441Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1441Test.java index 90232657a73..d966d03caa3 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1441Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1441Test.java @@ -29,13 +29,15 @@ void configurations() { // default configuration String defaultConfigAsString = new Gson().toJson(check.configurations()); - assertThat(defaultConfigAsString) - .isEqualTo("[\"single\",{\"avoidEscape\":true,\"allowTemplateLiterals\":true}]"); + assertThat(defaultConfigAsString).isEqualTo( + "[\"single\",{\"avoidEscape\":true,\"allowTemplateLiterals\":true}]" + ); // custom configuration check.singleQuotes = false; String customConfigAsString = new Gson().toJson(check.configurations()); - assertThat(customConfigAsString) - .isEqualTo("[\"double\",{\"avoidEscape\":true,\"allowTemplateLiterals\":true}]"); + assertThat(customConfigAsString).isEqualTo( + "[\"double\",{\"avoidEscape\":true,\"allowTemplateLiterals\":true}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1451Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1451Test.java index da52cd5abc1..5755fde794c 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1451Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S1451Test.java @@ -32,9 +32,8 @@ void config() { check.headerFormat = "// header format 20\\d\\d"; check.isRegularExpression = true; configAsString = new Gson().toJson(check.configurations()); - assertThat(configAsString) - .isEqualTo( - "[{\"headerFormat\":\"// header format 20\\\\d\\\\d\",\"isRegularExpression\":true}]" - ); + assertThat(configAsString).isEqualTo( + "[{\"headerFormat\":\"// header format 20\\\\d\\\\d\",\"isRegularExpression\":true}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2068Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2068Test.java index 9d831fda494..e17552a3ba4 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2068Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2068Test.java @@ -28,7 +28,9 @@ void configurations() { S2068 check = new S2068(); // default configuration String defaultConfigAsString = new Gson().toJson(check.configurations()); - assertThat(defaultConfigAsString).isEqualTo("[{\"passwordWords\":[\"password\",\"pwd\",\"passwd\"]}]"); + assertThat(defaultConfigAsString).isEqualTo( + "[{\"passwordWords\":[\"password\",\"pwd\",\"passwd\"]}]" + ); check.passwordWords = "foo, bar"; String customConfigAsString = new Gson().toJson(check.configurations()); diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2094Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2094Test.java index b2d4bffe52a..8afce4716b6 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2094Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2094Test.java @@ -26,9 +26,8 @@ class S2094Test { @Test void config() { String configAsString = new Gson().toJson(new S2094().configurations()); - assertThat(configAsString) - .isEqualTo( - "[{\"allowConstructorOnly\":false,\"allowEmpty\":false,\"allowStaticOnly\":true,\"allowWithDecorator\":true}]" - ); + assertThat(configAsString).isEqualTo( + "[{\"allowConstructorOnly\":false,\"allowEmpty\":false,\"allowStaticOnly\":true,\"allowWithDecorator\":true}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2430Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2430Test.java index c436ac206ce..2b7f9e1cf1a 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2430Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2430Test.java @@ -26,7 +26,8 @@ class S2430Test { @Test void configurations() { String configAsString = new Gson().toJson(new S2430().configurations()); - assertThat(configAsString) - .isEqualTo("[{\"newIsCap\":true,\"capIsNew\":false,\"properties\":false}]"); + assertThat(configAsString).isEqualTo( + "[{\"newIsCap\":true,\"capIsNew\":false,\"properties\":false}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2814Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2814Test.java index 981af8eb275..70e21128308 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2814Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S2814Test.java @@ -26,7 +26,8 @@ class S2814Test { @Test void configurations() { String configAsString = new Gson().toJson(new S2814().configurations()); - assertThat(configAsString) - .isEqualTo("[{\"builtinGlobals\":false,\"ignoreDeclarationMerge\":true}]"); + assertThat(configAsString).isEqualTo( + "[{\"builtinGlobals\":false,\"ignoreDeclarationMerge\":true}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S3524Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S3524Test.java index 77f5b4be364..7d522952004 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S3524Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S3524Test.java @@ -28,17 +28,20 @@ void test_configuration() { S3524 check = new S3524(); String config = new Gson().toJson(check.configurations()); - assertThat(config) - .isEqualTo("[{\"requireParameterParentheses\":false,\"requireBodyBraces\":false}]"); + assertThat(config).isEqualTo( + "[{\"requireParameterParentheses\":false,\"requireBodyBraces\":false}]" + ); check.parameterParens = true; config = new Gson().toJson(check.configurations()); - assertThat(config) - .isEqualTo("[{\"requireParameterParentheses\":true,\"requireBodyBraces\":false}]"); + assertThat(config).isEqualTo( + "[{\"requireParameterParentheses\":true,\"requireBodyBraces\":false}]" + ); check.bodyBraces = true; config = new Gson().toJson(check.configurations()); - assertThat(config) - .isEqualTo("[{\"requireParameterParentheses\":true,\"requireBodyBraces\":true}]"); + assertThat(config).isEqualTo( + "[{\"requireParameterParentheses\":true,\"requireBodyBraces\":true}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4137Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4137Test.java index c1fdc5f67f6..17f657877bf 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4137Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4137Test.java @@ -25,9 +25,9 @@ class S4137Test { @Test void configurations() { - String configAsString = new Gson() - .toJson(new S4137().configurations()); - assertThat(configAsString) - .isEqualTo("[{\"assertionStyle\":\"as\",\"objectLiteralTypeAssertions\":\"allow\"}]"); + String configAsString = new Gson().toJson(new S4137().configurations()); + assertThat(configAsString).isEqualTo( + "[{\"assertionStyle\":\"as\",\"objectLiteralTypeAssertions\":\"allow\"}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4327Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4327Test.java index 26429272782..947cdd8dfae 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4327Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4327Test.java @@ -25,7 +25,8 @@ class S4327Test { @Test void configurations() { - assertThat(new Gson().toJson(new S4327().configurations())) - .isEqualTo("[{\"allowDestructuring\":true}]"); + assertThat(new Gson().toJson(new S4327().configurations())).isEqualTo( + "[{\"allowDestructuring\":true}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4622Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4622Test.java index deb149bbce2..fc64f604545 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4622Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S4622Test.java @@ -31,5 +31,6 @@ void configurations() { assertThat(defaultConfigAsString).isEqualTo("[{\"threshold\":3}]"); check.threshold = 4; String customConfigAsString = new Gson().toJson(check.configurations()); - assertThat(customConfigAsString).isEqualTo("[{\"threshold\":4}]"); } + assertThat(customConfigAsString).isEqualTo("[{\"threshold\":4}]"); + } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S5693Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S5693Test.java index 714843d2383..e626f0e28bd 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S5693Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S5693Test.java @@ -28,10 +28,14 @@ void configurations() { S5693 check = new S5693(); // default configuration String defaultConfigAsString = new Gson().toJson(check.configurations()); - assertThat(defaultConfigAsString).isEqualTo("[{\"fileUploadSizeLimit\":8000000,\"standardSizeLimit\":2000000}]"); + assertThat(defaultConfigAsString).isEqualTo( + "[{\"fileUploadSizeLimit\":8000000,\"standardSizeLimit\":2000000}]" + ); check.fileUploadSizeLimit = 42; check.standardSizeLimit = 24; String customConfigAsString = new Gson().toJson(check.configurations()); - assertThat(customConfigAsString).isEqualTo("[{\"fileUploadSizeLimit\":42,\"standardSizeLimit\":24}]"); + assertThat(customConfigAsString).isEqualTo( + "[{\"fileUploadSizeLimit\":42,\"standardSizeLimit\":24}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6544Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6544Test.java index ccd00b45f4a..97cf76b53e6 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6544Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6544Test.java @@ -28,9 +28,8 @@ void config() { S6544 check = new S6544(); String defaultConfigAsString = new Gson().toJson(check.configurations()); - assertThat(defaultConfigAsString) - .isEqualTo( - "[{\"ignoreIIFE\":true,\"checksVoidReturn\":{\"attributes\":false,\"arguments\":false}}]" - ); + assertThat(defaultConfigAsString).isEqualTo( + "[{\"ignoreIIFE\":true,\"checksVoidReturn\":{\"attributes\":false,\"arguments\":false}}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6606Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6606Test.java index cea443a04ac..7259e6c497e 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6606Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6606Test.java @@ -26,9 +26,8 @@ class S6606Test { @Test void configurations() { String configAsString = new Gson().toJson(new S6606().configurations()); - assertThat(configAsString) - .isEqualTo( - "[{\"ignoreConditionalTests\":true,\"ignoreTernaryTests\":false,\"ignoreMixedLogicalExpressions\":true,\"allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing\":true}]" - ); + assertThat(configAsString).isEqualTo( + "[{\"ignoreConditionalTests\":true,\"ignoreTernaryTests\":false,\"ignoreMixedLogicalExpressions\":true,\"allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing\":true}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6821Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6821Test.java index 50a9ac957ab..697cb0e7741 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6821Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6821Test.java @@ -26,7 +26,8 @@ class S6821Test { @Test void config() { String configAsString = new Gson().toJson(new S6821().configurations()); - assertThat(configAsString) - .isEqualTo("[{\"ignoreNonDOM\":true,\"allowedInvalidRoles\":[\"text\"]}]"); + assertThat(configAsString).isEqualTo( + "[{\"ignoreNonDOM\":true,\"allowedInvalidRoles\":[\"text\"]}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6847Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6847Test.java index 98fc304def3..7f7b4b18780 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6847Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S6847Test.java @@ -26,6 +26,8 @@ class S6847Test { @Test void configurations() { var config = new Gson().toJson(new S6847().configurations()); - assertThat(config).isEqualTo("[{\"handlers\":[\"onClick\",\"onMouseDown\",\"onMouseUp\",\"onKeyPress\",\"onKeyDown\",\"onKeyUp\"]}]"); + assertThat(config).isEqualTo( + "[{\"handlers\":[\"onClick\",\"onMouseDown\",\"onMouseUp\",\"onKeyPress\",\"onKeyDown\",\"onKeyUp\"]}]" + ); } } diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S905Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S905Test.java index 15a564a3f31..e3e42c3b3c6 100644 --- a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S905Test.java +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S905Test.java @@ -25,11 +25,9 @@ class S905Test { @Test void test() { - String configAsString = new Gson() - .toJson(new S905().configurations()); - assertThat(configAsString) - .isEqualTo( - "[{\"allowShortCircuit\":true,\"allowTaggedTemplates\":true,\"allowTernary\":true,\"enforceForJSX\":true}]" - ); + String configAsString = new Gson().toJson(new S905().configurations()); + assertThat(configAsString).isEqualTo( + "[{\"allowShortCircuit\":true,\"allowTaggedTemplates\":true,\"allowTernary\":true,\"enforceForJSX\":true}]" + ); } } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptFilePredicate.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptFilePredicate.java index d118fdf6589..5fca705ce0f 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptFilePredicate.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptFilePredicate.java @@ -61,27 +61,22 @@ private JavaScriptFilePredicate() {} public static FilePredicate getYamlPredicate(FileSystem fs) { return fs .predicates() - .and( - fs.predicates().hasLanguage(YamlSensor.LANGUAGE), - inputFile -> { - try (Scanner scanner = new Scanner(inputFile.inputStream(), inputFile.charset().name())) { - while (scanner.hasNextLine()) { - String line = scanner.nextLine(); - if ( - line.contains("{{") && !HELM_DIRECTIVE_IN_COMMENT_OR_STRING.matcher(line).find() - ) { - return false; - } + .and(fs.predicates().hasLanguage(YamlSensor.LANGUAGE), inputFile -> { + try (Scanner scanner = new Scanner(inputFile.inputStream(), inputFile.charset().name())) { + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + if (line.contains("{{") && !HELM_DIRECTIVE_IN_COMMENT_OR_STRING.matcher(line).find()) { + return false; } - return true; - } catch (IOException e) { - throw new IllegalStateException( - String.format("Unable to read file: %s. %s", inputFile.uri(), e.getMessage()), - e - ); } + return true; + } catch (IOException e) { + throw new IllegalStateException( + String.format("Unable to read file: %s. %s", inputFile.uri(), e.getMessage()), + e + ); } - ); + }); } public static FilePredicate getJsTsPredicate(FileSystem fs) { diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptPlugin.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptPlugin.java index e677830b7e6..657adc10534 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptPlugin.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptPlugin.java @@ -36,7 +36,6 @@ import org.sonar.plugins.javascript.analysis.HtmlSensor; import org.sonar.plugins.javascript.analysis.JsTsChecks; import org.sonar.plugins.javascript.analysis.JsTsSensor; -import org.sonar.plugins.javascript.sonarlint.TsConfigCacheImpl; import org.sonar.plugins.javascript.analysis.TsConfigProvider; import org.sonar.plugins.javascript.analysis.YamlSensor; import org.sonar.plugins.javascript.bridge.AnalysisWarningsWrapper; @@ -56,6 +55,7 @@ import org.sonar.plugins.javascript.rules.JavaScriptRulesDefinition; import org.sonar.plugins.javascript.rules.TslintRulesDefinition; import org.sonar.plugins.javascript.rules.TypeScriptRulesDefinition; +import org.sonar.plugins.javascript.sonarlint.TsConfigCacheImpl; public class JavaScriptPlugin implements Plugin { @@ -163,8 +163,7 @@ public void define(Context context) { ); context.addExtensions( - PropertyDefinition - .builder(LCOV_REPORT_PATHS) + PropertyDefinition.builder(LCOV_REPORT_PATHS) .defaultValue(LCOV_REPORT_PATHS_DEFAULT_VALUE) .name("LCOV Files") .description("Paths (absolute or relative) to the files with LCOV data.") @@ -173,8 +172,7 @@ public void define(Context context) { .category(JS_TS_CATEGORY) .multiValues(true) .build(), - PropertyDefinition - .builder(JavaScriptLanguage.FILE_SUFFIXES_KEY) + PropertyDefinition.builder(JavaScriptLanguage.FILE_SUFFIXES_KEY) .defaultValue(JavaScriptLanguage.FILE_SUFFIXES_DEFVALUE) .name("JavaScript File Suffixes") .description(FILE_SUFFIXES_DESCRIPTION) @@ -183,8 +181,7 @@ public void define(Context context) { .multiValues(true) .onQualifiers(Qualifiers.PROJECT) .build(), - PropertyDefinition - .builder(TypeScriptLanguage.FILE_SUFFIXES_KEY) + PropertyDefinition.builder(TypeScriptLanguage.FILE_SUFFIXES_KEY) .defaultValue(TypeScriptLanguage.FILE_SUFFIXES_DEFVALUE) .name("TypeScript File Suffixes") .description(FILE_SUFFIXES_DESCRIPTION) @@ -193,8 +190,7 @@ public void define(Context context) { .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), - PropertyDefinition - .builder(TsConfigProvider.TSCONFIG_PATHS) + PropertyDefinition.builder(TsConfigProvider.TSCONFIG_PATHS) .name("TypeScript tsconfig.json location") .description("Comma-delimited list of paths to TSConfig files. Wildcards are supported.") .onQualifiers(Qualifiers.PROJECT) @@ -202,8 +198,7 @@ public void define(Context context) { .category(JS_TS_CATEGORY) .multiValues(true) .build(), - PropertyDefinition - .builder(PROPERTY_KEY_MAX_FILE_SIZE) + PropertyDefinition.builder(PROPERTY_KEY_MAX_FILE_SIZE) .name("Maximum size of analyzed files") .description( "Threshold for the maximum size of analyzed files (in kilobytes). " + @@ -215,8 +210,7 @@ public void define(Context context) { .type(PropertyType.INTEGER) .defaultValue("1000") .build(), - PropertyDefinition - .builder(JavaScriptPlugin.IGNORE_HEADER_COMMENTS) + PropertyDefinition.builder(JavaScriptPlugin.IGNORE_HEADER_COMMENTS) .defaultValue(JavaScriptPlugin.IGNORE_HEADER_COMMENTS_DEFAULT_VALUE.toString()) .name("Ignore header comments") .description("True to not count file header comments in comment metrics.") @@ -225,8 +219,7 @@ public void define(Context context) { .category(JS_TS_CATEGORY) .type(PropertyType.BOOLEAN) .build(), - PropertyDefinition - .builder(JavaScriptPlugin.ENVIRONMENTS) + PropertyDefinition.builder(JavaScriptPlugin.ENVIRONMENTS) .defaultValue(String.join(",", JavaScriptPlugin.ENVIRONMENTS_DEFAULT_VALUE)) .name("JavaScript execution environments") .description( @@ -240,8 +233,7 @@ public void define(Context context) { .multiValues(true) .category(JS_TS_CATEGORY) .build(), - PropertyDefinition - .builder(JavaScriptPlugin.GLOBALS) + PropertyDefinition.builder(JavaScriptPlugin.GLOBALS) .defaultValue(JavaScriptPlugin.GLOBALS_DEFAULT_VALUE) .name("Global variables") .description("List of global variables.") @@ -250,11 +242,14 @@ public void define(Context context) { .multiValues(true) .category(JS_TS_CATEGORY) .build(), - PropertyDefinition - .builder(SKIP_NODE_PROVISIONING_PROPERTY) + PropertyDefinition.builder(SKIP_NODE_PROVISIONING_PROPERTY) .defaultValue("false") .name("Skip the deployment of the embedded Node.js runtime") - .description(JavaScriptPlugin.getHTMLMarkup("Controls whether the scanner should skip the deployment of the embedded Node.js runtime, and use the host-provided runtime instead.\n\nAnalysis will fail if a compatible version of Node.js is not provided via `sonar.nodejs.executable` or the `PATH`.")) + .description( + JavaScriptPlugin.getHTMLMarkup( + "Controls whether the scanner should skip the deployment of the embedded Node.js runtime, and use the host-provided runtime instead.\n\nAnalysis will fail if a compatible version of Node.js is not provided via `sonar.nodejs.executable` or the `PATH`." + ) + ) .onQualifiers(Qualifiers.PROJECT) .subCategory(GENERAL) .category(JS_TS_CATEGORY) @@ -270,8 +265,7 @@ public void define(Context context) { ); context.addExtension( - PropertyDefinition - .builder(CssLanguage.FILE_SUFFIXES_KEY) + PropertyDefinition.builder(CssLanguage.FILE_SUFFIXES_KEY) .defaultValue(CssLanguage.FILE_SUFFIXES_DEFVALUE) .name("File Suffixes") .description(FILE_SUFFIXES_DESCRIPTION) @@ -292,8 +286,7 @@ public void define(Context context) { ); context.addExtension( - PropertyDefinition - .builder(ESLINT_REPORT_PATHS) + PropertyDefinition.builder(ESLINT_REPORT_PATHS) .name("ESLint Report Files") .description("Paths (absolute or relative) to the JSON files with ESLint issues.") .onQualifiers(Qualifiers.PROJECT) @@ -304,8 +297,7 @@ public void define(Context context) { ); context.addExtension( - PropertyDefinition - .builder(TSLINT_REPORT_PATHS) + PropertyDefinition.builder(TSLINT_REPORT_PATHS) .name("TSLint Report Files") .description("Paths (absolute or relative) to the JSON files with TSLint issues.") .onQualifiers(Qualifiers.PROJECT) @@ -318,8 +310,7 @@ public void define(Context context) { context.addExtensions(CssMetricSensor.class, StylelintReportSensor.class); context.addExtension( - PropertyDefinition - .builder(StylelintReportSensor.STYLELINT_REPORT_PATHS) + PropertyDefinition.builder(StylelintReportSensor.STYLELINT_REPORT_PATHS) .defaultValue(StylelintReportSensor.STYLELINT_REPORT_PATHS_DEFAULT_VALUE) .name("Stylelint Report Files") .description("Paths (absolute or relative) to the JSON files with stylelint issues.") @@ -331,10 +322,7 @@ public void define(Context context) { ); } else { var sonarLintPluginAPIManager = new SonarLintPluginAPIManager(); - sonarLintPluginAPIManager.addSonarLintExtensions( - context, - new SonarLintPluginAPIVersion() - ); + sonarLintPluginAPIManager.addSonarLintExtensions(context, new SonarLintPluginAPIVersion()); } } @@ -344,10 +332,7 @@ public void define(Context context) { * Note that this method should probably not be hosted here: either it should be part of a dedicated helper class, or it should be provided by a Markdown-to-HTML library. Since it is only used in this specific class, it is acceptable for now to have it hosted here. */ private static String getHTMLMarkup(String markdownMarkup) { - return markdownMarkup - .replace("\n", "
") - .replaceAll("`(.*?)`", "$1") - ; + return markdownMarkup.replace("\n", "
").replaceAll("`(.*?)`", "$1"); } static class SonarLintPluginAPIManager { diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptProfilesDefinition.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptProfilesDefinition.java index f9c7a145b0d..cf1dec004a4 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptProfilesDefinition.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/JavaScriptProfilesDefinition.java @@ -126,7 +126,7 @@ static Set getSecurityRuleKeys( Method getRuleKeysMethod = rulesClass.getMethod(ruleKeysMethodName, String.class); return (Set) getRuleKeysMethod.invoke(null, language); } catch (ClassNotFoundException e) { - LOG.debug("{} is not found, {}", className, securityRuleMessage(e)); + LOG.debug("{} is not found, {}", className, securityRuleMessage(e)); } catch (NoSuchMethodException e) { LOG.debug("Method not found on {}, {}", className, securityRuleMessage(e)); } catch (IllegalAccessException | InvocationTargetException e) { diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AbstractAnalysis.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AbstractAnalysis.java index d2d6d4df644..fb74c30676d 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AbstractAnalysis.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AbstractAnalysis.java @@ -72,7 +72,12 @@ protected static String inputFileLanguage(InputFile file) { : JavaScriptLanguage.KEY; } - void initialize(SensorContext context, JsTsChecks checks, AnalysisMode analysisMode, AnalysisConsumers consumers) { + void initialize( + SensorContext context, + JsTsChecks checks, + AnalysisMode analysisMode, + AnalysisConsumers consumers + ) { LOG.debug("Initializing {}", getClass().getName()); this.context = context; contextUtils = new ContextUtils(context); @@ -87,7 +92,12 @@ protected boolean isJavaScript(InputFile file) { abstract void analyzeFiles(List inputFiles, List tsConfigs) throws IOException; - protected void analyzeFile(InputFile file, @Nullable List tsConfigs, @Nullable TsProgram tsProgram, boolean dirtyPackageJSONCache) throws IOException { + protected void analyzeFile( + InputFile file, + @Nullable List tsConfigs, + @Nullable TsProgram tsProgram, + boolean dirtyPackageJSONCache + ) throws IOException { if (context.isCancelled()) { throw new CancellationException( "Analysis interrupted because the SensorContext is in cancelled state" @@ -99,8 +109,19 @@ protected void analyzeFile(InputFile file, @Nullable List tsConfigs, @Nu LOG.debug("Analyzing file: {}", file.uri()); progressReport.nextFile(file.toString()); var fileContent = contextUtils.shouldSendFileContent(file) ? file.contents() : null; - var skipAst = !consumers.hasConsumers() || !(contextUtils.isSonarArmorEnabled() || contextUtils.isSonarJasminEnabled() || contextUtils.isSonarJaredEnabled()); - var request = getJsAnalysisRequest(file, fileContent, tsProgram, tsConfigs, skipAst, dirtyPackageJSONCache); + var skipAst = + !consumers.hasConsumers() || + !(contextUtils.isSonarArmorEnabled() || + contextUtils.isSonarJasminEnabled() || + contextUtils.isSonarJaredEnabled()); + var request = getJsAnalysisRequest( + file, + fileContent, + tsProgram, + tsConfigs, + skipAst, + dirtyPackageJSONCache + ); var response = isJavaScript(file) ? bridgeServer.analyzeJavaScript(request) diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AbstractBridgeSensor.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AbstractBridgeSensor.java index 366be5a6793..13525e1c815 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AbstractBridgeSensor.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AbstractBridgeSensor.java @@ -16,6 +16,8 @@ */ package org.sonar.plugins.javascript.analysis; +import static org.sonar.plugins.javascript.nodejs.NodeCommandBuilderImpl.NODE_EXECUTABLE_PROPERTY; + import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -33,8 +35,6 @@ import org.sonar.plugins.javascript.nodejs.NodeCommandException; import org.sonar.plugins.javascript.utils.Exclusions; -import static org.sonar.plugins.javascript.nodejs.NodeCommandBuilderImpl.NODE_EXECUTABLE_PROPERTY; - public abstract class AbstractBridgeSensor implements Sensor { private static final Logger LOG = LoggerFactory.getLogger(AbstractBridgeSensor.class); @@ -48,10 +48,7 @@ public abstract class AbstractBridgeSensor implements Sensor { protected SensorContext context; protected ContextUtils contextUtils; - protected AbstractBridgeSensor( - BridgeServer bridgeServer, - String lang - ) { + protected AbstractBridgeSensor(BridgeServer bridgeServer, String lang) { this.bridgeServer = bridgeServer; this.lang = lang; } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisConsumers.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisConsumers.java index 21c811c1c05..95dd29ade40 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisConsumers.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisConsumers.java @@ -53,6 +53,6 @@ public void doneAnalysis() { } public boolean hasConsumers() { - return ! consumers.isEmpty(); + return !consumers.isEmpty(); } } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisProcessor.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisProcessor.java index c8e4d30d89a..d081c888987 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisProcessor.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisProcessor.java @@ -16,12 +16,12 @@ */ package org.sonar.plugins.javascript.analysis; +import static org.sonar.plugins.javascript.JavaScriptFilePredicate.isTypeScriptFile; import static org.sonar.plugins.javascript.analysis.QuickFixSupport.addQuickFixes; import static org.sonar.plugins.javascript.api.CustomRuleRepository.Language.JAVASCRIPT; import static org.sonar.plugins.javascript.api.CustomRuleRepository.Language.TYPESCRIPT; import static org.sonar.plugins.javascript.bridge.BridgeServer.Issue; import static org.sonar.plugins.javascript.bridge.BridgeServer.IssueLocation; -import static org.sonar.plugins.javascript.JavaScriptFilePredicate.isTypeScriptFile; import static org.sonar.plugins.javascript.utils.UnicodeEscape.unicodeEscape; import java.io.Serializable; @@ -62,6 +62,7 @@ @ScannerSide @SonarLintSide public class AnalysisProcessor { + private static final Logger LOG = LoggerFactory.getLogger(AnalysisProcessor.class); private static final Version SONARLINT_6_3 = Version.create(6, 3); @@ -222,13 +223,12 @@ private void saveHighlightedSymbols(List highlightedSymbols) Location declaration = highlightedSymbol.declaration(); NewSymbol newSymbol; try { - newSymbol = - symbolTable.newSymbol( - declaration.startLine(), - declaration.startCol(), - declaration.endLine(), - declaration.endCol() - ); + newSymbol = symbolTable.newSymbol( + declaration.startLine(), + declaration.startCol(), + declaration.endLine(), + declaration.endCol() + ); } catch (RuntimeException e) { LOG.warn("Failed to create symbol declaration in {} at {}", file.uri(), declaration); continue; @@ -251,10 +251,7 @@ private void saveHighlightedSymbols(List highlightedSymbols) private void saveMetrics(Metrics metrics) { if (file.type() == InputFile.Type.TEST || contextUtils.isSonarLint()) { - noSonarFilter.noSonarInFile( - file, - Set.copyOf(metrics.nosonarLines()) - ); + noSonarFilter.noSonarInFile(file, Set.copyOf(metrics.nosonarLines())); return; } @@ -266,10 +263,7 @@ private void saveMetrics(Metrics metrics) { saveMetric(file, CoreMetrics.COMPLEXITY, metrics.complexity()); saveMetric(file, CoreMetrics.COGNITIVE_COMPLEXITY, metrics.cognitiveComplexity()); - noSonarFilter.noSonarInFile( - file, - Set.copyOf(metrics.nosonarLines()) - ); + noSonarFilter.noSonarInFile(file, Set.copyOf(metrics.nosonarLines())); FileLinesContext fileLinesContext = fileLinesContextFactory.createFor(file); for (int line : metrics.ncloc()) { @@ -299,7 +293,10 @@ private void saveCpd(List cpdTokens) { } newCpdTokens.save(); } catch (RuntimeException e) { - LOG.warn("Failed to save CPD token in {}. File will not be analyzed for duplications.", file.uri()); + LOG.warn( + "Failed to save CPD token in {}. File will not be analyzed for duplications.", + file.uri() + ); LOG.warn("Exception cause", e); } } @@ -320,12 +317,14 @@ void saveIssue(Issue issue) { } } - issue.secondaryLocations().forEach(secondary -> { - NewIssueLocation newIssueLocation = newSecondaryLocation(file, newIssue, secondary); - if (newIssueLocation != null) { - newIssue.addLocation(newIssueLocation); - } - }); + issue + .secondaryLocations() + .forEach(secondary -> { + NewIssueLocation newIssueLocation = newSecondaryLocation(file, newIssue, secondary); + if (newIssueLocation != null) { + newIssue.addLocation(newIssueLocation); + } + }); if (issue.cost() != null) { newIssue.gap(issue.cost()); @@ -382,7 +381,12 @@ private static NewIssueLocation newSecondaryLocation( location.endColumn() != null ) { newIssueLocation.at( - inputFile.newRange(location.line(), location.column(), location.endLine(), location.endColumn()) + inputFile.newRange( + location.line(), + location.column(), + location.endLine(), + location.endColumn() + ) ); if (location.message() != null) { newIssueLocation.message(unicodeEscape(location.message())); diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisWithProgram.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisWithProgram.java index 9dc2368878b..3287c328114 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisWithProgram.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisWithProgram.java @@ -40,6 +40,7 @@ public class AnalysisWithProgram extends AbstractAnalysis { private static final Logger LOG = LoggerFactory.getLogger(AnalysisWithProgram.class); + public AnalysisWithProgram( BridgeServer bridgeServer, AnalysisProcessor analysisProcessor, @@ -143,5 +144,4 @@ private void analyzeProgram(TsProgram program, Set analyzedFiles) thr LOG.info("Analyzed {} file(s) with current program", counter); } - } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisWithWatchProgram.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisWithWatchProgram.java index 37cb06c25d4..717fdd6c395 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisWithWatchProgram.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/AnalysisWithWatchProgram.java @@ -59,7 +59,12 @@ public void analyzeFiles(List inputFiles, List tsConfigs) thr progressReport.start(inputFiles.size(), inputFiles.iterator().next().toString()); for (InputFile inputFile : inputFiles) { var tsConfigFile = tsConfigCache.getTsConfigForInputFile(inputFile); - analyzeFile(inputFile, tsConfigFile == null ? List.of() : List.of(tsConfigFile.getFilename()), null, this.tsConfigCache.getAndResetShouldClearDependenciesCache()); + analyzeFile( + inputFile, + tsConfigFile == null ? List.of() : List.of(tsConfigFile.getFilename()), + null, + this.tsConfigCache.getAndResetShouldClearDependenciesCache() + ); } success = true; if (analysisProcessor.parsingErrorFilesCount() > 0) { diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/CssRuleSensor.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/CssRuleSensor.java index 0a70db201b3..bd8ea6a9dec 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/CssRuleSensor.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/CssRuleSensor.java @@ -147,11 +147,7 @@ void analyzeFile(InputFile inputFile, SensorContext context, List } } - private void saveIssues( - SensorContext context, - InputFile inputFile, - List issues - ) { + private void saveIssues(SensorContext context, InputFile inputFile, List issues) { for (Issue issue : issues) { RuleKey ruleKey = cssRules.getActiveSonarKey(issue.ruleId()); if (ruleKey == null) { @@ -230,14 +226,12 @@ protected List getInputFiles() { p.hasLanguages("js", "ts") ); - return StreamSupport - .stream( - fileSystem - .inputFiles(p.or(cssFilePredicate, webFilePredicate, vueFilePredicate)) - .spliterator(), - false - ) - .toList(); + return StreamSupport.stream( + fileSystem + .inputFiles(p.or(cssFilePredicate, webFilePredicate, vueFilePredicate)) + .spliterator(), + false + ).toList(); } public static boolean hasCssFiles(SensorContext context) { diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/JsTsChecks.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/JsTsChecks.java index 0e968124714..3a2ee55e3b3 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/JsTsChecks.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/JsTsChecks.java @@ -138,12 +138,11 @@ RuleKey parsingErrorRuleKey() { } protected void initParsingErrorRuleKey() { - this.parseErrorRuleKey = - all() - .filter(S2260.class::isInstance) - .findFirst() - .map(this::ruleKeyFor) - .orElse(null); + this.parseErrorRuleKey = all() + .filter(S2260.class::isInstance) + .findFirst() + .map(this::ruleKeyFor) + .orElse(null); } List eslintRules() { @@ -175,8 +174,9 @@ static class LanguageAndRepository { final String repository; LanguageAndRepository(Language language, String repository) { - this.language = - language == Language.JAVASCRIPT ? JavaScriptLanguage.KEY : TypeScriptLanguage.KEY; + this.language = language == Language.JAVASCRIPT + ? JavaScriptLanguage.KEY + : TypeScriptLanguage.KEY; this.repository = repository; } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/JsTsSensor.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/JsTsSensor.java index 07a575e8f83..e0f1e148784 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/JsTsSensor.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/JsTsSensor.java @@ -71,9 +71,10 @@ public void describe(SensorDescriptor descriptor) { protected List getInputFiles() { FileSystem fileSystem = context.fileSystem(); FilePredicate allFilesPredicate = JavaScriptFilePredicate.getJsTsPredicate(fileSystem); - return StreamSupport - .stream(fileSystem.inputFiles(allFilesPredicate).spliterator(), false) - .toList(); + return StreamSupport.stream( + fileSystem.inputFiles(allFilesPredicate).spliterator(), + false + ).toList(); } @Override @@ -88,11 +89,7 @@ protected void analyzeFiles(List inputFiles) throws IOException { exclusions ); - var tsConfigs = getTsConfigs( - contextUtils, - this::createTsConfigFile, - tsConfigCache - ); + var tsConfigs = getTsConfigs(contextUtils, this::createTsConfigFile, tsConfigCache); AbstractAnalysis analysis; if (shouldAnalyzeWithProgram()) { analysis = analysisWithProgram; diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/LookupConfigProviderFilter.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/LookupConfigProviderFilter.java index 7d5c0736a44..c30fc2227fe 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/LookupConfigProviderFilter.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/LookupConfigProviderFilter.java @@ -16,20 +16,19 @@ */ package org.sonar.plugins.javascript.analysis; -import org.sonar.api.config.Configuration; -import org.sonar.api.utils.WildcardPattern; -import org.sonar.plugins.javascript.JavaScriptLanguage; -import org.sonar.plugins.javascript.JavaScriptPlugin; -import org.sonar.plugins.javascript.TypeScriptLanguage; +import static java.util.Arrays.stream; +import static java.util.stream.Stream.concat; import java.nio.file.Path; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.function.Predicate; - -import static java.util.Arrays.stream; -import static java.util.stream.Stream.concat; +import org.sonar.api.config.Configuration; +import org.sonar.api.utils.WildcardPattern; +import org.sonar.plugins.javascript.JavaScriptLanguage; +import org.sonar.plugins.javascript.JavaScriptPlugin; +import org.sonar.plugins.javascript.TypeScriptLanguage; /** * This class partially reproduces the behavior of JavaScriptExclusionsFileFilter's implementation. @@ -46,6 +45,7 @@ * @see JavaScriptExclusionsFileFilter */ public class LookupConfigProviderFilter { + private LookupConfigProviderFilter() {} static class FileFilter implements Predicate { @@ -91,16 +91,16 @@ public PathFilter(Configuration config) { WildcardPattern[] tsExcludedPatterns = WildcardPattern.create( config.getStringArray(JavaScriptPlugin.TS_EXCLUSIONS_KEY) ); - exclusions = - concat(stream(jsExcludedPatterns), stream(tsExcludedPatterns)) - .toArray(WildcardPattern[]::new); + exclusions = concat(stream(jsExcludedPatterns), stream(tsExcludedPatterns)).toArray( + WildcardPattern[]::new + ); } } private static boolean isExclusionOverridden(Configuration config) { return ( config.get(JavaScriptPlugin.JS_EXCLUSIONS_KEY).isPresent() || - config.get(JavaScriptPlugin.TS_EXCLUSIONS_KEY).isPresent() + config.get(JavaScriptPlugin.TS_EXCLUSIONS_KEY).isPresent() ); } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/QuickFixSupport.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/QuickFixSupport.java index 1c858568ab5..5c23bd3d12c 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/QuickFixSupport.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/QuickFixSupport.java @@ -34,24 +34,31 @@ private QuickFixSupport() { // utility class } - static void addQuickFixes( - Issue issue, - NewIssue sonarLintIssue, - InputFile file - ) { - issue.quickFixes().forEach(qf -> { - LOG.debug("Adding quick fix for issue {} at line {}", issue.ruleId(), issue.line()); - var quickFix = sonarLintIssue.newQuickFix(); - var fileEdit = quickFix.newInputFileEdit(); - qf.edits().forEach(e -> { - var textEdit = fileEdit.newTextEdit(); - textEdit - .at(file.newRange(e.loc().line(), e.loc().column(), e.loc().endLine(), e.loc().endColumn())) - .withNewText(e.text()); - fileEdit.on(file).addTextEdit(textEdit); + static void addQuickFixes(Issue issue, NewIssue sonarLintIssue, InputFile file) { + issue + .quickFixes() + .forEach(qf -> { + LOG.debug("Adding quick fix for issue {} at line {}", issue.ruleId(), issue.line()); + var quickFix = sonarLintIssue.newQuickFix(); + var fileEdit = quickFix.newInputFileEdit(); + qf + .edits() + .forEach(e -> { + var textEdit = fileEdit.newTextEdit(); + textEdit + .at( + file.newRange( + e.loc().line(), + e.loc().column(), + e.loc().endLine(), + e.loc().endColumn() + ) + ) + .withNewText(e.text()); + fileEdit.on(file).addTextEdit(textEdit); + }); + quickFix.addInputFileEdit(fileEdit).message(qf.message()); + sonarLintIssue.addQuickFix(quickFix); }); - quickFix.addInputFileEdit(fileEdit).message(qf.message()); - sonarLintIssue.addQuickFix(quickFix); - }); } } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/TsConfigOrigin.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/TsConfigOrigin.java index 6805d4da76d..7fa5ee730dc 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/TsConfigOrigin.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/TsConfigOrigin.java @@ -19,5 +19,5 @@ public enum TsConfigOrigin { PROPERTY, LOOKUP, - FALLBACK + FALLBACK, } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/TsConfigProvider.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/TsConfigProvider.java index a34f65a03d3..5d6b52e8c17 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/TsConfigProvider.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/TsConfigProvider.java @@ -18,6 +18,8 @@ import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; +import static org.sonar.plugins.javascript.analysis.LookupConfigProviderFilter.FileFilter; +import static org.sonar.plugins.javascript.analysis.LookupConfigProviderFilter.PathFilter; import com.google.gson.Gson; import java.io.File; @@ -41,8 +43,6 @@ import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.sensor.SensorContext; -import static org.sonar.plugins.javascript.analysis.LookupConfigProviderFilter.FileFilter; -import static org.sonar.plugins.javascript.analysis.LookupConfigProviderFilter.PathFilter; import org.sonar.plugins.javascript.JavaScriptFilePredicate; import org.sonar.plugins.javascript.sonarlint.TsConfigCache; import org.sonarsource.analyzer.commons.FileProvider; @@ -84,11 +84,17 @@ static List getTsConfigs( ) throws IOException { var defaultProvider = contextUtils.isSonarLint() ? new TsConfigProvider.WildcardTsConfigProvider(tsConfigCache, tsConfigFileCreator) - : new TsConfigProvider.DefaultTsConfigProvider(tsConfigFileCreator, JavaScriptFilePredicate::getJsTsPredicate); - + : new TsConfigProvider.DefaultTsConfigProvider( + tsConfigFileCreator, + JavaScriptFilePredicate::getJsTsPredicate + ); var provider = new TsConfigProvider( - List.of(new PropertyTsConfigProvider(), new LookupTsConfigProvider(tsConfigCache), defaultProvider), + List.of( + new PropertyTsConfigProvider(), + new LookupTsConfigProvider(tsConfigCache), + defaultProvider + ), tsConfigCache ); @@ -112,11 +118,11 @@ List tsconfigs(SensorContext context) throws IOException { } static class PropertyTsConfigProvider implements Provider { + @Override public List tsconfigs(SensorContext context) { if ( - !context.config().hasKey(TSCONFIG_PATHS) && - !context.config().hasKey(TSCONFIG_PATHS_ALIAS) + !context.config().hasKey(TSCONFIG_PATHS) && !context.config().hasKey(TSCONFIG_PATHS_ALIAS) ) { return emptyList(); } @@ -178,7 +184,9 @@ private static Path getFilePath(File baseDir, String path) { } static class LookupTsConfigProvider implements Provider { + private final TsConfigCache cache; + LookupTsConfigProvider(@Nullable TsConfigCache cache) { this.cache = cache; } @@ -232,7 +240,9 @@ public TsConfigOrigin type() { } abstract static class GeneratedTsConfigFileProvider implements Provider { + static class TsConfig { + List files; Map compilerOptions = new LinkedHashMap<>(); List include; @@ -247,7 +257,6 @@ static class TsConfig { this.include = include; } - List writeFileWith(TsConfigFileCreator tsConfigFileCreator) { try { return singletonList(tsConfigFileCreator.createTsConfigFile(new Gson().toJson(this))); @@ -286,6 +295,7 @@ public final List tsconfigs(SensorContext context) throws IOException { } static class DefaultTsConfigProvider extends GeneratedTsConfigFileProvider { + private final Function filePredicateProvider; private final TsConfigFileCreator tsConfigFileCreator; @@ -316,6 +326,7 @@ private File writeToJsonFile(TsConfig tsConfig) throws IOException { } static class WildcardTsConfigProvider extends GeneratedTsConfigFileProvider { + static final String MAX_FILES_PROPERTY = "sonar.javascript.sonarlint.typechecking.maxfiles"; static final int DEFAULT_MAX_FILES_FOR_TYPE_CHECKING = 20_000; @@ -343,7 +354,8 @@ private static String getProjectRoot(SensorContext context) { @Override List getDefaultTsConfigs(SensorContext context) { - boolean deactivated = tsConfigCache == null || isBeyondLimit(context, tsConfigCache.getProjectSize()); + boolean deactivated = + tsConfigCache == null || isBeyondLimit(context, tsConfigCache.getProjectSize()); if (deactivated) { return emptyList(); } else { diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CacheAnalysis.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CacheAnalysis.java index 35cb6012a03..50cd679df52 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CacheAnalysis.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CacheAnalysis.java @@ -30,10 +30,7 @@ public CacheAnalysis(@Nullable List ucfgPaths, List cpdTokens) this.cpdTokens = cpdTokens; } - public static CacheAnalysis fromResponse( - List ucfgPaths, - List cpdTokens - ) { + public static CacheAnalysis fromResponse(List ucfgPaths, List cpdTokens) { return new CacheAnalysis(ucfgPaths, cpdTokens); } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CacheAnalysisSerialization.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CacheAnalysisSerialization.java index 8637fab73f0..baf057136fd 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CacheAnalysisSerialization.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CacheAnalysisSerialization.java @@ -31,8 +31,11 @@ public class CacheAnalysisSerialization extends CacheSerialization { super(context, cacheKey); ucfgFileSerialization = new UCFGFilesSerialization(context, cacheKey.forUcfg()); cpdSerialization = new CpdSerialization(context, cacheKey.forCpd()); - fileMetadataSerialization = - new JsonSerialization<>(FileMetadata.class, context, cacheKey.forFileMetadata()); + fileMetadataSerialization = new JsonSerialization<>( + FileMetadata.class, + context, + cacheKey.forFileMetadata() + ); } @Override diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CpdSerialization.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CpdSerialization.java index b7064177dfb..aabc566c0b9 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CpdSerialization.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/CpdSerialization.java @@ -30,8 +30,10 @@ class CpdSerialization extends CacheSerialization { CpdSerialization(SensorContext context, CacheKey cacheKey) { super(context, cacheKey); cpdDataSerialization = new CacheSerialization(context, cacheKey.withPrefix(DATA_PREFIX)); - cpdStringTableSerialization = - new CacheSerialization(context, cacheKey.withPrefix(STRING_TABLE_PREFIX)); + cpdStringTableSerialization = new CacheSerialization( + context, + cacheKey.withPrefix(STRING_TABLE_PREFIX) + ); } @Override diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/SequenceSerialization.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/SequenceSerialization.java index b093a8fe990..c6e6628b5ec 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/SequenceSerialization.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/SequenceSerialization.java @@ -46,8 +46,7 @@ class SequenceSerialization extends CacheSerialization { private static String convertToEntryName(Path baseAbsolutePath, Path fileAbsolutePath) { var relativePath = baseAbsolutePath.relativize(fileAbsolutePath); - return StreamSupport - .stream(relativePath.spliterator(), false) + return StreamSupport.stream(relativePath.spliterator(), false) .map(Path::getFileName) .map(Path::toString) .collect(joining(ENTRY_SEPARATOR)); diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/StringTable.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/StringTable.java index f4447dd821e..4c543faa662 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/StringTable.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/analysis/cache/StringTable.java @@ -42,13 +42,10 @@ class StringTable { } int getIndex(@Nullable String string) { - return table.computeIfAbsent( - string, - s -> { - byIndex.add(s); - return byIndex.size() - 1; - } - ); + return table.computeIfAbsent(string, s -> { + byIndex.add(s); + return byIndex.size() - 1; + }); } String getString(int index) { diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/filter/JavaScriptExclusionsFileFilter.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/filter/JavaScriptExclusionsFileFilter.java index 285f3f80c76..10d2c087e46 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/filter/JavaScriptExclusionsFileFilter.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/filter/JavaScriptExclusionsFileFilter.java @@ -31,23 +31,23 @@ public class JavaScriptExclusionsFileFilter implements InputFileFilter { private final List cssAssessors; public JavaScriptExclusionsFileFilter(Configuration configuration) { - jsTsAssessors = - Stream - .of( - new PathAssessor(configuration), - new SizeAssessor(configuration), - new MinificationAssessor(), - new BundleAssessor() - ) - .filter(assessor -> shouldBeEnabled(assessor, configuration)) - .toList(); + jsTsAssessors = Stream.of( + new PathAssessor(configuration), + new SizeAssessor(configuration), + new MinificationAssessor(), + new BundleAssessor() + ) + .filter(assessor -> shouldBeEnabled(assessor, configuration)) + .toList(); // We ignore the size limit for CSS files, because analyzing large CSS files takes a reasonable amount of time - cssAssessors = - Stream - .of(new PathAssessor(configuration), new MinificationAssessor(), new BundleAssessor()) - .filter(assessor -> shouldBeEnabled(assessor, configuration)) - .toList(); + cssAssessors = Stream.of( + new PathAssessor(configuration), + new MinificationAssessor(), + new BundleAssessor() + ) + .filter(assessor -> shouldBeEnabled(assessor, configuration)) + .toList(); } private static boolean shouldBeEnabled(Assessor assessor, Configuration configuration) { diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/lcov/CoverageSensor.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/lcov/CoverageSensor.java index 796dd91bdde..ed27e1a097a 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/lcov/CoverageSensor.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/lcov/CoverageSensor.java @@ -48,9 +48,8 @@ public class CoverageSensor implements Sensor { public void describe(SensorDescriptor descriptor) { descriptor .onlyOnLanguages(JavaScriptLanguage.KEY, TypeScriptLanguage.KEY) - .onlyWhenConfiguration(conf -> - conf.hasKey(LCOV_REPORT_PATHS) || - conf.hasKey(LCOV_REPORT_PATHS_ALIAS) + .onlyWhenConfiguration( + conf -> conf.hasKey(LCOV_REPORT_PATHS) || conf.hasKey(LCOV_REPORT_PATHS_ALIAS) ) .name("JavaScript/TypeScript Coverage") .onlyOnFileType(Type.MAIN); @@ -61,16 +60,16 @@ public void execute(SensorContext context) { Set reports = new HashSet<>( Arrays.asList(context.config().getStringArray(LCOV_REPORT_PATHS)) ); - reports.addAll( - Arrays.asList(context.config().getStringArray(LCOV_REPORT_PATHS_ALIAS)) - ); + reports.addAll(Arrays.asList(context.config().getStringArray(LCOV_REPORT_PATHS_ALIAS))); logIfUsedProperty(context, LCOV_REPORT_PATHS); logIfUsedProperty(context, LCOV_REPORT_PATHS_ALIAS); if ( - context.config().hasKey(LCOV_REPORT_PATHS) && - context.config().hasKey(LCOV_REPORT_PATHS_ALIAS) + context.config().hasKey(LCOV_REPORT_PATHS) && context.config().hasKey(LCOV_REPORT_PATHS_ALIAS) ) { - LOG.info("Merging coverage reports from {} and {}.", LCOV_REPORT_PATHS, LCOV_REPORT_PATHS_ALIAS + LOG.info( + "Merging coverage reports from {} and {}.", + LCOV_REPORT_PATHS, + LCOV_REPORT_PATHS_ALIAS ); } List lcovFiles = getLcovFiles(context.fileSystem().baseDir(), reports); @@ -132,7 +131,9 @@ private static void saveCoverageFromLcovFiles(SensorContext context, List LOG.debug("Unresolved paths:\n{}", String.join("\n", unresolvedPaths)); } else { LOG.warn( - "First unresolved path: {} (Run in DEBUG mode to get full list of unresolved paths)", unresolvedPaths.get(0)); + "First unresolved path: {} (Run in DEBUG mode to get full list of unresolved paths)", + unresolvedPaths.get(0) + ); } } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/lcov/LCOVParser.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/lcov/LCOVParser.java index a939170a647..d7812301ca3 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/lcov/LCOVParser.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/lcov/LCOVParser.java @@ -90,11 +90,9 @@ private Map parse(List lines) { for (String line : lines) { reportLineNum++; if (line.startsWith(SF)) { - fileData = - files.computeIfAbsent( - inputFileForSourceFile(line), - inputFile -> inputFile == null ? null : new FileData(inputFile) - ); + fileData = files.computeIfAbsent(inputFileForSourceFile(line), inputFile -> + inputFile == null ? null : new FileData(inputFile) + ); } else if (fileData != null) { if (line.startsWith(DA)) { parseLineCoverage(fileData, reportLineNum, line); @@ -147,10 +145,10 @@ private void parseLineCoverage(FileData fileData, int reportLineNum, String line private void logWrongDataWarning(String dataType, int reportLineNum, Exception e) { LOG.debug( - "Problem during processing LCOV report: can't save {} data for line {} of coverage report file ({}).", - dataType, - reportLineNum, - e.toString() + "Problem during processing LCOV report: can't save {} data for line {} of coverage report file ({}).", + dataType, + reportLineNum, + e.toString() ); inconsistenciesCounter++; } @@ -201,9 +199,8 @@ private static class FileData { void addBranch(Integer lineNumber, String branchNumber, Integer taken) { checkLine(lineNumber); - Map branchesForLine = branches.computeIfAbsent( - lineNumber, - l -> new HashMap<>() + Map branchesForLine = branches.computeIfAbsent(lineNumber, l -> + new HashMap<>() ); branchesForLine.merge(branchNumber, taken, Integer::sum); } diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/rules/TslintRulesDefinition.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/rules/TslintRulesDefinition.java index 100eb996e07..7f4cea77048 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/rules/TslintRulesDefinition.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/rules/TslintRulesDefinition.java @@ -51,8 +51,7 @@ public class TslintRulesDefinition implements RulesDefinition { ) ); - private static final Map RULE_TYPE_MAP = RULE_LOADERS - .stream() + private static final Map RULE_TYPE_MAP = RULE_LOADERS.stream() .flatMap(loader -> loader .ruleKeys() diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/sonarlint/TsConfigCacheImpl.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/sonarlint/TsConfigCacheImpl.java index 08174cf69d5..bbbf0625054 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/sonarlint/TsConfigCacheImpl.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/sonarlint/TsConfigCacheImpl.java @@ -42,6 +42,7 @@ @ScannerSide @SonarLintSide(lifespan = SonarLintSide.MODULE) public class TsConfigCacheImpl implements TsConfigCache, ModuleFileListener { + private static final Logger LOG = LoggerFactory.getLogger(TsConfigCacheImpl.class); BridgeServer bridgeServer; @@ -60,6 +61,7 @@ public TsConfigCacheImpl(BridgeServer bridgeServer) { } class Cache { + Map inputFileToTsConfigFilesMap = new HashMap<>(); Set discoveredTsConfigFiles = new HashSet<>(); List originalTsConfigFiles = new ArrayList<>(); @@ -78,18 +80,28 @@ TsConfigFile getTsConfigForInputFile(InputFile inputFile) { pendingTsConfigFiles = improvedPendingTsConfigOrder(inputFile); - LOG.debug("Continuing BFS for file: {}, pending order: {}", inputFilePath, pendingTsConfigFiles); + LOG.debug( + "Continuing BFS for file: {}, pending order: {}", + inputFilePath, + pendingTsConfigFiles + ); while (!pendingTsConfigFiles.isEmpty()) { var tsConfigPath = pendingTsConfigFiles.pop(); LOG.debug("Computing tsconfig {} from bridge", tsConfigPath); TsConfigFile tsConfigFile = bridgeServer.loadTsConfig(tsConfigPath); - tsConfigFile.getFiles().forEach(file -> inputFileToTsConfigFilesMap.putIfAbsent(file, tsConfigFile)); + tsConfigFile + .getFiles() + .forEach(file -> inputFileToTsConfigFilesMap.putIfAbsent(file, tsConfigFile)); if (!tsConfigFile.getProjectReferences().isEmpty()) { LOG.info("Adding referenced project's tsconfigs {}", tsConfigFile.getProjectReferences()); - tsConfigFile.getProjectReferences().stream().filter(refPath -> !discoveredTsConfigFiles.contains(refPath)).forEach(refPath -> { - discoveredTsConfigFiles.add(refPath); - pendingTsConfigFiles.addFirst(refPath); - }); + tsConfigFile + .getProjectReferences() + .stream() + .filter(refPath -> !discoveredTsConfigFiles.contains(refPath)) + .forEach(refPath -> { + discoveredTsConfigFiles.add(refPath); + pendingTsConfigFiles.addFirst(refPath); + }); } if (inputFileToTsConfigFilesMap.containsKey(inputFilePath)) { var foundTsConfigFile = inputFileToTsConfigFilesMap.get(inputFilePath); @@ -140,7 +152,9 @@ private Deque improvedPendingTsConfigOrder(InputFile inputFile) { var newPendingTsConfigFiles = new ArrayDeque(); var notMatchingPendingTsConfigFiles = new ArrayList(); pendingTsConfigFiles.forEach(ts -> { - if (inputFile.absolutePath().startsWith(Path.of(ts).getParent().toAbsolutePath().toString())) { + if ( + inputFile.absolutePath().startsWith(Path.of(ts).getParent().toAbsolutePath().toString()) + ) { newPendingTsConfigFiles.add(ts); } else { notMatchingPendingTsConfigFiles.add(ts); @@ -184,7 +198,9 @@ public void initializeWith(List tsConfigPaths, TsConfigOrigin tsConfigOr if (tsConfigOrigin == TsConfigOrigin.FALLBACK && cache.initialized) { return; } - if (tsConfigOrigin != TsConfigOrigin.FALLBACK && cache.originalTsConfigFiles.equals(tsConfigPaths)) { + if ( + tsConfigOrigin != TsConfigOrigin.FALLBACK && cache.originalTsConfigFiles.equals(tsConfigPaths) + ) { return; } @@ -208,7 +224,11 @@ public void process(ModuleFileEvent moduleFileEvent) { } else if (filename.endsWith("package.json")) { LOG.debug("Package json update, will clear dependency cache on next analysis request."); shouldClearDependenciesCache = true; - } else if (moduleFileEvent.getType() == ModuleFileEvent.Type.CREATED && (JavaScriptFilePredicate.isJavaScriptFile(file) || JavaScriptFilePredicate.isTypeScriptFile(file))) { + } else if ( + moduleFileEvent.getType() == ModuleFileEvent.Type.CREATED && + (JavaScriptFilePredicate.isJavaScriptFile(file) || + JavaScriptFilePredicate.isTypeScriptFile(file)) + ) { // The file to tsconfig cache is cleared, as potentially the tsconfig file that would cover this new file // has already been processed, and we would not be aware of it. By clearing the cache, we guarantee correctness. LOG.debug("Clearing input file to tsconfig cache"); diff --git a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/utils/PathWalker.java b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/utils/PathWalker.java index 9738e0af4fe..8efba414513 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/utils/PathWalker.java +++ b/sonar-plugin/sonar-javascript-plugin/src/main/java/org/sonar/plugins/javascript/utils/PathWalker.java @@ -73,8 +73,7 @@ public Path next() { var path = paths.removeFirst(); if (Files.isDirectory(path)) { - Stream - .ofNullable(path.toFile().listFiles()) + Stream.ofNullable(path.toFile().listFiles()) .flatMap(Arrays::stream) .map(File::toPath) .filter(p -> !exclusion.test(p)) diff --git a/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/JavaScriptFilePredicateTest.java b/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/JavaScriptFilePredicateTest.java index a4fe0eb807f..c0a5d9681a1 100644 --- a/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/JavaScriptFilePredicateTest.java +++ b/sonar-plugin/sonar-javascript-plugin/src/test/java/org/sonar/plugins/javascript/JavaScriptFilePredicateTest.java @@ -121,8 +121,15 @@ void testJavaScriptPredicate() { .filter(f -> !isTypeScriptFile(f)) .map(InputFile::filename) .toList(); - assertThat(filenames) - .containsExactlyInAnyOrder("a.js", "c.vue", "d.vue", "e.vue", "f.vue", "h.vue", "j.jsx"); + assertThat(filenames).containsExactlyInAnyOrder( + "a.js", + "c.vue", + "d.vue", + "e.vue", + "f.vue", + "h.vue", + "j.jsx" + ); } @Test @@ -233,34 +240,29 @@ void testYamlPredicate() { fs.files(predicate).forEach(files::add); var filenames = files.stream().map(File::getName).toList(); - assertThat(filenames) - .containsExactlyInAnyOrder( - "single-quote.yaml", - "double-quote.yaml", - "comment.yaml", - "code-fresh.yaml" - ); + assertThat(filenames).containsExactlyInAnyOrder( + "single-quote.yaml", + "double-quote.yaml", + "comment.yaml", + "code-fresh.yaml" + ); } @Test void testIsTypeScriptFile() { - var tsFile = TestInputFileBuilder - .create("", "file.ts") + var tsFile = TestInputFileBuilder.create("", "file.ts") .setLanguage(TypeScriptLanguage.KEY) .build(); assertThat(isTypeScriptFile(tsFile)).isTrue(); - var jsFile = TestInputFileBuilder - .create("", "file.js") + var jsFile = TestInputFileBuilder.create("", "file.js") .setLanguage(JavaScriptLanguage.KEY) .build(); assertThat(isTypeScriptFile(jsFile)).isFalse(); - var vueFile = TestInputFileBuilder - .create("", "file.vue") + var vueFile = TestInputFileBuilder.create("", "file.vue") .setLanguage(JavaScriptLanguage.KEY) .build(); assertThat(isTypeScriptFile(vueFile)).isFalse(); - var tsVueFile = TestInputFileBuilder - .create("", "file.vue") + var tsVueFile = TestInputFileBuilder.create("", "file.vue") .setLanguage(JavaScriptLanguage.KEY) .setContents("