Skip to content

Commit

Permalink
JS-276 Ruling is executable with parameters (#4766)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-kebets-sonarsource authored Aug 21, 2024
1 parent eda39a1 commit e3badda
Show file tree
Hide file tree
Showing 54 changed files with 173 additions and 114 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"new-rule": "ts-node tools/newRule.ts",
"generate-meta": "ts-node tools/generate-meta.ts && cd packages/jsts/src/rules && npm run eslint-docs",
"ruling": "node tools/prepare-ruling.js && jest ./packages/ruling/tests/projects/*.ruling.test.ts",
"ruling-parametrized": "node tools/prepare-ruling.js && SONAR_RULING_SETTINGS=../settings.js jest ./packages/ruling/tests/projects/*.ruling.test.ts",
"ruling-sync": "rsync -avh packages/ruling/tests/actual/jsts/ its/ruling/src/test/expected/jsts/ --delete",
"update-ruling-data": "mvn -f sonar-plugin/sonar-javascript-plugin/pom.xml compile && ts-node packages/ruling/tests/tools/parseRulesData.ts",
"bridge:compile": "tsc -b packages profiling && npm run _:bridge:copy-protofile",
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/Ghost.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/Joust.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/TypeScript.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/ace.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/ag-grid.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/amplify.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/angular.js.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/ant-design.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/backbone.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/console.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/courselit.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/desktop.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/eigen.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/es5-shim.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/file-for-rules.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/fireact.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/fireface.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/http.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/ionic2-auth.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/it-tools.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/jStorage.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/jira-clone.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/jquery.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/jshint.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/knockout.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ruling/tests/projects/moose.ruling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { compareSync } from 'dir-compare';
import { setupBeforeAll, testProject } from '../tools/testProject';

describe('Ruling', () => {
const { project, expectedPath, actualPath } = setupBeforeAll(__filename);
const { project, expectedPath, actualPath, rules } = setupBeforeAll(__filename);
it(
project.name,
async () => {
await testProject(project);
await testProject(project, actualPath, rules);
expect(
compareSync(expectedPath, actualPath, {
compareContent: true,
Expand Down
Loading

0 comments on commit e3badda

Please sign in to comment.