Skip to content

[Refactor]: Split up Checkers (Interface) #38

Description

@GrandadEvans

I am wanting to write the code for a system that will have an Interface, and mean each "checker" has it's own class (Open/Closed principle).
The peck.json file can have

{
  "checkers": [
    "file-names",
    "method-names",
    "class-names",
    "comments",
    "etc"
  ]
}

and then the checkers can be iterated through, a list of words compiled, and then checked

Class BaseChacker {
    public function __construct(
        public $wordsToCheck = [],
        public $checkersBasePath = './src/Checkers/',
    ) {
        foreach($checkers as $checker) {
            if ($this->ableToImportCheckerThroughResolution($checker)) {
                $this->addCheckersWordsToWordList();
            }
        }
    }

    private function ableToImportCheckerThroughResolution(string $checker): array {
        $checkerFileName = $checker->checkerFilename;
        $path = "{$this->checkersBasePath}{$checker}";

        if (!file_exists($path)) {
            throw new CheckerDoesNotExistException($checker);
        }
    }
}

I want to see the existing PRs I have through first, so that I can get some feedback, and get an up to date codebase, and then I know whether the changes I have so far can be implemented into the new changes.
Saying that I'll probably start work on it anyway

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions