codeclimate/codeclimate-phpcodesniffer

View on GitHub

Showing 11 of 11 total issues

Method run has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run($files)
    {
        try {
            $resultFile = tempnam(sys_get_temp_dir(), 'phpcodesniffer');

Severity: Minor
Found in Runner.php - About 1 hr to fix

    Function queuePaths has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function queuePaths($dir, $prefix = '', $exclusions = []) {
            $dir = rtrim($dir, '\\/');
    
            foreach (scandir($dir) as $f) {
                if (in_array("$prefix$f", $exclusions)) {
    Severity: Minor
    Found in Runner.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Each class must be in a namespace of at least one level (a top-level vendor name)
    Open

    class Runner
    Severity: Minor
    Found in Runner.php by phpcodesniffer

    Function run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function run($files)
        {
            try {
                $resultFile = tempnam(sys_get_temp_dir(), 'phpcodesniffer');
    
    
    Severity: Minor
    Found in Runner.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function queueWithIncludePaths has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function queueWithIncludePaths() {
            foreach ($this->config['include_paths'] as $f) {
                if ($f !== '.' and $f !== '..') {
                    if (is_dir($f)) {
                        $this->queuePaths("$f", "$f/");
    Severity: Minor
    Found in Runner.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Expected 1 space after IF keyword; 0 found
    Open

            if(isset($this->config['include_paths'])) {
    Severity: Minor
    Found in Runner.php by phpcodesniffer

    Opening brace should be on a new line
    Open

        public function queuePaths($dir, $prefix = '', $exclusions = []) {
    Severity: Minor
    Found in Runner.php by phpcodesniffer

    Opening brace should be on a new line
    Open

        public function filterByExtension($f, $prefix = '') {
    Severity: Minor
    Found in Runner.php by phpcodesniffer

    Opening brace should be on a new line
    Open

        public static function isValidIssue($issue) {
    Severity: Minor
    Found in Sniffs.php by phpcodesniffer

    Opening brace should be on a new line
    Open

        public function queueWithIncludePaths() {
    Severity: Minor
    Found in Runner.php by phpcodesniffer

    Opening brace should be on a new line
    Open

        private function fileExtensions() {
    Severity: Minor
    Found in Runner.php by phpcodesniffer
    Severity
    Category
    Status
    Source
    Language