Skip to content

Commit

Permalink
refactor: moved code under modules
Browse files Browse the repository at this point in the history
  • Loading branch information
marabesi committed Jun 30, 2024
1 parent a0fae6c commit f8211a0
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"test:all": "mocha -r ts-node/register src/modules/**/**.test.ts",
"test:coverage": "nyc --reporter=text mocha -r ts-node/register src/modules/**/**.test.ts",
"coveralls": "npm run test:coveralls:coverage && coveralls --verbose < lcov.info",
"cli": "ts-node src/cli/find-smells.ts"
"cli": "ts-node src/modules/cli/find-smells.ts"
},
"devDependencies": {
"@types/esprima": "^4.0.6",
Expand Down
4 changes: 2 additions & 2 deletions vscode/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from 'vscode';
import path from 'path';
import { SmellDetector } from './modules/smells-detector';
import { Smell } from './modules/types';
import { SmellDetector } from './modules/smells-finder/smells-detector';
import { Smell } from './modules/smells-finder/types';
import { ComposedSmell, warningDecorationType } from './extension.types';

let currentDecoration = warningDecorationType;
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/extension.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Range, window } from 'vscode';
import { Smell } from "./modules/types";
import { Smell } from "./modules/smells-finder/types";

export type ComposedSmell = {
smell: Smell;
Expand Down
5 changes: 0 additions & 5 deletions vscode/src/modules/SmellsFinder.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'node:fs/promises';
import { SmellDetector } from '../modules/smells-detector';
import { SmellDetector } from '../smells-finder/smells-detector';

const args = process.argv;
const fileName = args[2];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Syntax, parseScript } from "esprima";
import { SmellsFinder } from "./SmellsFinder";
import { Smell } from "./types";
import { Smell, SmellsFinder } from "../types";

export class JavascriptSmells implements SmellsFinder {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as ts from 'typescript';

import { SmellsFinder } from "./SmellsFinder";
import { Smell } from "./types";
import { Smell, SmellsFinder } from "../types";

export class TypescriptSmells implements SmellsFinder {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { JavascriptSmells } from './JavascriptSmells';
import { TypescriptSmells } from './TypescriptSmells';
import { JavascriptSmells } from './languages/JavascriptSmells';
import { TypescriptSmells } from './languages/TypescriptSmells';
import { Smell } from './types';

export class SmellDetector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ export type Smell = {
endsAt: number;
description: string; //supports markdown
diagnostic: string; //no support for markdown
};
};

export interface SmellsFinder {
searchSmells(): Smell[];
}

0 comments on commit f8211a0

Please sign in to comment.