dancryer / PHPCI

PHPCI is a free and open source continuous integration tool specifically designed for PHP.
BSD 2-Clause "Simplified" License
2.42k stars 439 forks source link

Plugin php_cpd failes with exception: LineStart must be an integer #1246

Open soulflyman opened 8 years ago

soulflyman commented 8 years ago

Plugin php_cpd runs without any exceptions and the result is schon in the Errors-Tab.

Actual behaviour

Plugin php_cpd failes with the Message

Exception: LineStart must be an integer. PLUGIN: FAILED

and no result information is written to the Errors-Tab.

Steps to reproduce

  1. Install phpci with all plugins
  2. setup a project with the phpci.yml below
  3. build a project wiht a lot of copy and paste :wink:

    Environment info

Operating System: Debian 8 PHP Version: PHP 5.6.24-0+deb8u1 (cli) (built: Jul 26 2016 08:17:07) MySQL Version: 5.5.48

Logs or other output that would be helpful

command:

composer install --no-dev -o

output:

Loading composer repositories with package information
Installing dependencies from lock file
  - Removing jakub-onderka/php-parallel-lint (v0.8)
  - Removing phploc/phploc (2.1.5)
  - Removing sebastian/finder-facade (1.2.1)
  - Removing symfony/finder (v3.1.2)
  - Removing theseer/fdomdocument (1.6.1)
  - Removing sebastian/git (2.1.3)
  - Removing squizlabs/php_codesniffer (2.6.2)
  - Removing phpmd/phpmd (2.4.3)
  - Removing pdepend/pdepend (2.2.4)
  - Removing symfony/dependency-injection (v3.1.2)
  - Removing phpunit/phpunit (4.8.27)
  - Removing phpspec/prophecy (v1.6.1)
  - Removing phpdocumentor/reflection-docblock (3.1.0)
  - Removing phpdocumentor/type-resolver (0.2)
  - Removing phpdocumentor/reflection-common (1.0)
  - Removing webmozart/assert (1.0.2)
  - Removing phpunit/php-code-coverage (2.2.4)
  - Removing phpunit/php-token-stream (1.4.8)
  - Removing phpunit/php-file-iterator (1.4.1)
  - Removing phpunit/php-timer (1.0.8)
  - Removing phpunit/phpunit-mock-objects (2.3.8)
  - Removing doctrine/instantiator (1.0.5)
  - Removing phpunit/php-text-template (1.2.1)
  - Removing sebastian/comparator (1.2.0)
  - Removing sebastian/diff (1.4.1)
  - Removing sebastian/environment (1.3.7)
  - Removing sebastian/exporter (1.2.2)
  - Removing sebastian/recursion-context (1.0.2)
  - Removing sebastian/global-state (1.1.1)
  - Removing sebastian/version (1.0.6)
  - Removing block8/php-docblock-checker (1.0.3)
Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
Generating optimized autoload files

After this all builds fail because of missing plugins, I don't know if it is a good idea to recomend this command if it makes all mutch worse?

However after reinstallaing the plugins we can go back to topic because the problem still exists.

phpci.yaml

build_settings:
    clone_depth: 1 # depth of 1 is a shallow clone, remove this line to clone entire repo
    ignore:
        - "vendor"
        - "tests"
        - "css"
        - "fonts"
        - "images"
        - "js"
        - "less"

setup:

test:
    php_mess_detector:
        allow_failures: true
        allowed_warnings: -1
        allowed_errors: -1
        rules:
              - "cleancode"
              - "controversial"
              - "codesize"
              - "design"
              - "naming"
              - "unusedcode"
    php_code_sniffer:
        standard: "/phpcs.xml" # The leading slash is needed to trigger an external ruleset.
                               # Without it, PHPCI looks for a rule named "phpcs.xml"
        allowed_errors: -1     # Even a single error will cause the build to fail. -1 = unlimited
        allowed_warnings: -1
        allow_failures: true
    php_cpd:
        allow_failures: true
        allowed_errors: -1
    php_loc:
    php_docblock_checker:
        allow_failures: true
        allowed_warnings: -1
        allowed_errors: -1
        skip_classes: true

Build log:

Klone nach '/mnt/nas/phpci/PHPCI/build/107_ed72b'...
Checke Dateien aus: 100% (1228/1228), Fertig.

663d15a231486ea4dcac28c79fe57a16ea904945
Working copy created: /
RUNNING PLUGIN: php_mess_detector
PLUGIN: SUCCESS
RUNNING PLUGIN: php_code_sniffer
PLUGIN: SUCCESS
RUNNING PLUGIN: php_cpd
phpcpd 2.0.1 by Sebastian Bergmann.
Found 10 exact clones with 1074 duplicated lines in 8 files:
  - /inc/manualinput.php:11-84
    /inc/adjustvalues.php:8-81

  - /inc/class/chartdaten.php:9-33
    /inc/class/tabledaten.php:6-30

  - /inc/class/chartdaten.php:214-264
    /inc/class/tabledaten.php:183-233

  - /inc/class/chartdaten.php:225-252
    /inc/class/UserInput.php:67-94

  - /inc/class/UserInput.php:161-207
    /inc/class/opaldaten.php:183-229

  - /inc/class/chartdaten.php:30-173
    /inc/class/customchartdaten.php:19-162

  - /inc/class/chartdaten.php:219-652
    /inc/class/customchartdaten.php:201-634

  - /inc/class/chartdaten.php:219-364
    /inc/class/eventdaten.php:261-406

  - /inc/class/daten.php:328-380
    /inc/class/eventdaten.php:409-461

  - /inc/class/daten.php:470-551
    /inc/class/eventdaten.php:617-698

11.54% duplicated lines out of 9308 total lines of code.
Time: 822 ms, Memory: 9.25Mb
Exception: LineStart must be an integer.
PLUGIN: FAILED
RUNNING PLUGIN: php_loc
phploc 2.1.5 by Sebastian Bergmann.
Directories                                          3
Files                                               37
Size
  Lines of Code (LOC)                             9308
  Comment Lines of Code (CLOC)                     519 (5.58%)
  Non-Comment Lines of Code (NCLOC)               8789 (94.42%)
  Logical Lines of Code (LLOC)                    1716 (18.44%)
    Classes                                       1302 (75.87%)
      Average Class Length                          68
        Minimum Class Length                         1
        Maximum Class Length                       283
      Average Method Length                         12
        Minimum Method Length                        0
        Maximum Method Length                       91
    Functions                                        0 (0.00%)
      Average Function Length                        0
    Not in classes or functions                    414 (24.13%)
Cyclomatic Complexity
  Average Complexity per LLOC                     0.31
  Average Complexity per Class                   22.37
    Minimum Class Complexity                      1.00
    Maximum Class Complexity                     86.00
  Average Complexity per Method                   5.19
    Minimum Method Complexity                     1.00
    Maximum Method Complexity                    36.00
Dependencies
  Global Accesses                                  117
    Global Constants                                 0 (0.00%)
    Global Variables                                 7 (5.98%)
    Super-Global Variables                         110 (94.02%)
  Attribute Accesses                               641
    Non-Static                                     641 (100.00%)
    Static                                           0 (0.00%)
  Method Calls                                     541
    Non-Static                                     490 (90.57%)
    Static                                          51 (9.43%)
Structure
  Namespaces                                         0
  Interfaces                                         0
  Traits                                             0
  Classes                                           19
    Abstract Classes                                 0 (0.00%)
    Concrete Classes                                19 (100.00%)
  Methods                                           97
    Scope
      Non-Static Methods                            96 (98.97%)
      Static Methods                                 1 (1.03%)
    Visibility
      Public Methods                                79 (81.44%)
      Non-Public Methods                            18 (18.56%)
  Functions                                          0
    Named Functions                                  0 (0.00%)
    Anonymous Functions                              0 (0.00%)
  Constants                                          0
    Global Constants                                 0 (0.00%)
    Class Constants                                  0 (0.00%)
PLUGIN: SUCCESS
RUNNING PLUGIN: php_docblock_checker
PLUGIN: SUCCESS
BUILD SUCCESS
Removing Build.
optio commented 8 years ago

Have exactly the same issue, started occurring since 2 days ago. Was working without issue before.

(the missing newline before the timestamp on the last line is also how it's shown in the shell output)

[2016-08-10 11:01:54] DaemoniseCommand.INFO: RUNNING PLUGIN: php_cpd {"buildID":"88"} []
[2016-08-10 11:01:54] DaemoniseCommand.DEBUG: Looking for binary: phpcpd {"buildID":"88"} []
[2016-08-10 11:01:54] DaemoniseCommand.DEBUG: Found in vendor/bin: phpcpd {"buildID":"88"} []
[2016-08-10 11:01:55] DaemoniseCommand.INFO: phpcpd 2.0.4 by Sebastian Bergmann. {"buildID":"88"} []
[2016-08-10 11:01:55] DaemoniseCommand.INFO: Found 1 exact clones with 30 duplicated lines in 2 files: {"buildID":"88"} []
[...]
[2016-08-10 11:01:55] DaemoniseCommand.INFO: 0.35% duplicated lines out of 8507 total lines of code. {"buildID":"88"} []
[2016-08-10 11:01:55] DaemoniseCommand.INFO: Time: 160 ms, Memory: 6.00MB {"buildID":"88"} []
phpcpd 2.0.4 by Sebastian Bergmann.
Found 1 exact clones with 30 duplicated lines in 2 files:
[...]
0.35% duplicated lines out of 8507 total lines of code.
Time: 160 ms, Memory: 6.00MB[2016-08-10 11:01:55] DaemoniseCommand.ERROR: Exception: LineStart must be an integer. {"exception":"[object] (b8\\Exception\\HttpException\\ValidationException(code: 0): LineStart must be an integer. at /home/tester/server/phpci/vendor/block8/b8framework/b8/Model.php:161)","buildID":"88"} []
tankist commented 7 years ago

https://github.com/Block8/PHPCI/pull/1201