rossaddison / invoice

An Open Source Invoicing System including various languages e.g. Zulu and Afrikaans.
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Scrutinizer Test Setup Failing #13

Closed rossaddison closed 3 weeks ago

rossaddison commented 3 weeks ago

What steps will reproduce the problem? Trying to implement Scrutinizer

What is the expected result? Scrutinizer examine php code

What do you get instead? The following error:

[Warning]: Installing Pear alongside of Pyrus is still experimental. [Info]: Loaded extension plugin [Info]: Loaded apc Plugin. [Info]: Loaded composer Plugin. [Info]: Loaded github Plugin. [Info]: Loaded pyrus Plugin. [Info]: Loaded uprofiler Plugin. [Info]: Loaded xdebug Plugin. [Info]: Loaded xhprof Plugin. [Info]: php.ini-development gets used as php.ini [Info]: Building 8.1.13 into /home/scrutinizer/.phpenv/versions/8.1.13


| BUILD ERROR |

Here are the last 10 lines from the log:


configure: error: Package requirements (openssl >= 1.0.2) were not met:

Requested 'openssl >= 1.0.2' but version of OpenSSL is 1.0.1f

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables OPENSSL_CFLAGS and OPENSSL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.

The full Log is available at '/tmp/php-build.8.1.13.20240820110937.log'. [Warn]: Aborting build.

Additional info

Q A
Version Online
PHP version Min 8.1
Operating system
rossaddison commented 3 weeks ago

A simplest version of scrutinizer.yml was inserted into the repository root underneath the following paragraph:

This restricted the first inspection to thesrc/Invoice folder as seen below under filter:. This same setup was included in Scrutinizer under the Default Configuration for the specific rossaddison\invoice. So I ensured both files correspond with each other and one exists in Github repo i.e. rossaddison\invoice and the other exists at scrutinizer-ci.com. On the first run I deliberately excluded all checks to get a no issue result. Scrutinizer has built a config file for me automatically. I will sort the dependency and excluded sections according to true or false. Gradually I will integrate php checks into the file and keep the sorting sequence as true first, and false second in priority. So the following file will now be replaced.

checks:
  php: true

filter:
  paths:
    - src/Invoice

build:
  image: default-bionic

  environment:
    php:
      version: 8.1.13
      ini:
        xdebug.mode: develop

  nodes:
    analysis:
      tests:
        override:
          - php-scrutinizer-run

with:

checks:
  php:
    duplication: true
    unused_parameters: true

    unused_methods: false
    argument_type_checks: false
    verify_property_names: false
    method_calls_on_non_object: false
    fix_doc_comments: false
    instanceof_class_exists: false
    catch_class_exists: false
    assignment_of_null_return: false
    use_statement_alias_conflict: false

  javascript: true

  coding_style:
    php:
      spaces:
        around_operators:
          bitwise: false
        other:
          after_type_cast: false

filter:
  paths:
    - src/Invoice
  excluded_paths:
    - 'src/Invoice/Helpers/Country-list/*'
    - 'src/Invoice/Helpers/StoreCove/Exceptions/*'
    - 'config/console/*'
    - 'src/Contact/mail/*'
    - 'src/Invoice/Asset/pciAsset/*'
    - 'config/environments/*'
    - 'src/Asset/*'
    - 'src/Command/*'
    - 'src/Middleware/*'
    - phpinfo.php
    - src/Timer.php
    - 'resources/mail/*'
    - 'src/Invoice/Enum/*'
    - configuration.php
    - 'resources/backend/*'
    - src/Installer.php
    - src/User/User.php
    - src/Auth/Token.php
    - config/web/events.php
    - src/Auth/Identity.php
    - src/Widget/QrCode.php
    - 'resources/messages/fil/*'
    - 'src/Controller/Actions/*'
    - 'resources/messages/af-ZA/*'
    - src/Auth/AuthService.php
    - src/Invoice/Ubl/Item.php
    - src/User/UserService.php
    - src/Invoice/Ubl/Price.php
    - config/common/di/cache.php
    - config/common/di/cycle.php
    - config/common/di/psr17.php
    - src/Invoice/Ubl/Schema.php
    - src/Widget/LabelSwitch.php
    - config/common/bootstrap.php
    - config/common/di/logger.php
    - config/common/di/sentry.php
    - 'src/Invoice/Group/Exception/*'
    - src/Invoice/Ubl/Address.php
    - src/Invoice/Ubl/Contact.php
    - src/Widget/FlashMessage.php
    - config/common/rbac-rules.php
    - config/web/di/rate-limit.php
    - src/Invoice/Entity/Group.php
    - src/Invoice/Ubl/Delivery.php
    - src/Invoice/Ubl/TaxTotal.php
    - src/Invoice/Ubl/UnitCode.php
    - config/common/di/hydrator.php
    - src/Invoice/Entity/Family.php
    - src/Invoice/Ubl/Generator.php
    - src/Invoice/Ubl/TaxScheme.php
    - config/common/di/validator.php
    - src/Invoice/Entity/Profile.php
    - src/Invoice/Entity/Project.php
    - src/Invoice/Entity/TaxRate.php
    - src/Invoice/Libraries/Lang.php
    - src/Invoice/Ubl/Attachment.php
    - src/Invoice/Ubl/CreditNote.php
    - config/common/di/rbac-rules.php
    - src/Invoice/Entity/Contract.php
    - src/Invoice/Ubl/InvoiceLine.php
    - src/Invoice/Ubl/TaxSubTotal.php
    - src/Invoice/Entity/InvCustom.php
    - 'src/Invoice/Helpers/InvoicePlane/*'
    - src/Invoice/Ubl/PaymentMeans.php
    - src/Invoice/Ubl/PaymentTerms.php
    - 'src/Invoice/UserClient/Exception/*'
    - src/Invoice/Asset/ReportAsset.php
    - src/Invoice/Entity/InvSentLog.php
    - src/Invoice/Entity/InvTaxRate.php
    - src/Invoice/Entity/ItemLookup.php
    - src/Invoice/Entity/SalesOrder.php
    - src/Invoice/Entity/UnitPeppol.php
    - src/Invoice/Entity/UserClient.php
    - src/Invoice/Entity/UserCustom.php
    - src/Invoice/Libraries/Cryptor.php
    - src/Invoice/Ubl/InvoicePeriod.php
    - src/Widget/PerformanceMetrics.php
    - src/Invoice/Entity/CustomValue.php
    - src/Invoice/Entity/QuoteCustom.php
    - src/Invoice/Family/FamilyInput.php
    - src/Invoice/Ubl/CreditNoteLine.php
    - src/Invoice/Ubl/OrderReference.php
    - src/Invoice/Ubl/PartyTaxScheme.php
    - src/Invoice/Entity/ClientCustom.php
    - src/Invoice/Entity/ClientPeppol.php
    - src/Invoice/Entity/FromDropDown.php
    - src/Invoice/Entity/QuoteTaxRate.php
    - src/Invoice/Helpers/ModalHelper.php
    - src/Invoice/Ubl/AllowanceCharge.php
    - src/Invoice/Ubl/InvoiceTypeCode.php
    - src/Auth/Form/ChangePasswordForm.php
    - src/Invoice/Asset/MonospaceAsset.php
    - src/Invoice/Entity/DeliveryParty.php
    - '*.min.js'
  dependency_paths:
    - 'src/Invoice/Helpers/Country-list/*'
    - 'src/Invoice/Helpers/StoreCove/Exceptions/*'
    - 'config/console/*'
    - 'src/Contact/mail/*'
    - 'src/Invoice/Asset/pciAsset/*'
    - 'config/environments/*'
    - 'src/Asset/*'
    - 'src/Command/*'
    - 'src/Middleware/*'
    - phpinfo.php
    - src/Timer.php
    - 'resources/mail/*'
    - 'src/Invoice/Enum/*'
    - configuration.php
    - 'resources/backend/*'
    - src/Installer.php
    - src/User/User.php
    - src/Auth/Token.php
    - config/web/events.php
    - src/Auth/Identity.php
    - src/Widget/QrCode.php
    - 'resources/messages/fil/*'
    - 'src/Controller/Actions/*'
    - 'resources/messages/af-ZA/*'
    - src/Auth/AuthService.php
    - src/Invoice/Ubl/Item.php
    - src/User/UserService.php
    - src/Invoice/Ubl/Price.php
    - config/common/di/cache.php
    - config/common/di/cycle.php
    - config/common/di/psr17.php
    - src/Invoice/Ubl/Schema.php
    - src/Widget/LabelSwitch.php
    - config/common/bootstrap.php
    - config/common/di/logger.php
    - config/common/di/sentry.php
    - 'src/Invoice/Group/Exception/*'
    - src/Invoice/Ubl/Address.php
    - src/Invoice/Ubl/Contact.php
    - src/Widget/FlashMessage.php
    - config/common/rbac-rules.php
    - config/web/di/rate-limit.php
    - src/Invoice/Entity/Group.php
    - src/Invoice/Ubl/Delivery.php
    - src/Invoice/Ubl/TaxTotal.php
    - src/Invoice/Ubl/UnitCode.php
    - config/common/di/hydrator.php
    - src/Invoice/Entity/Family.php
    - src/Invoice/Ubl/Generator.php
    - src/Invoice/Ubl/TaxScheme.php
    - config/common/di/validator.php
    - src/Invoice/Entity/Profile.php
    - src/Invoice/Entity/Project.php
    - src/Invoice/Entity/TaxRate.php
    - src/Invoice/Libraries/Lang.php
    - src/Invoice/Ubl/Attachment.php
    - src/Invoice/Ubl/CreditNote.php
    - config/common/di/rbac-rules.php
    - src/Invoice/Entity/Contract.php
    - src/Invoice/Ubl/InvoiceLine.php
    - src/Invoice/Ubl/TaxSubTotal.php
    - src/Invoice/Entity/InvCustom.php
    - 'src/Invoice/Helpers/InvoicePlane/*'
    - src/Invoice/Ubl/PaymentMeans.php
    - src/Invoice/Ubl/PaymentTerms.php
    - 'src/Invoice/UserClient/Exception/*'
    - src/Invoice/Asset/ReportAsset.php
    - src/Invoice/Entity/InvSentLog.php
    - src/Invoice/Entity/InvTaxRate.php
    - src/Invoice/Entity/ItemLookup.php
    - src/Invoice/Entity/SalesOrder.php
    - src/Invoice/Entity/UnitPeppol.php
    - src/Invoice/Entity/UserClient.php
    - src/Invoice/Entity/UserCustom.php
    - src/Invoice/Libraries/Cryptor.php
    - src/Invoice/Ubl/InvoicePeriod.php
    - src/Widget/PerformanceMetrics.php
    - src/Invoice/Entity/CustomValue.php
    - src/Invoice/Entity/QuoteCustom.php
    - src/Invoice/Family/FamilyInput.php
    - src/Invoice/Ubl/CreditNoteLine.php
    - src/Invoice/Ubl/OrderReference.php
    - src/Invoice/Ubl/PartyTaxScheme.php
    - src/Invoice/Entity/ClientCustom.php
    - src/Invoice/Entity/ClientPeppol.php
    - src/Invoice/Entity/FromDropDown.php
    - src/Invoice/Entity/QuoteTaxRate.php
    - src/Invoice/Helpers/ModalHelper.php
    - src/Invoice/Ubl/AllowanceCharge.php
    - src/Invoice/Ubl/InvoiceTypeCode.php
    - src/Auth/Form/ChangePasswordForm.php
    - src/Invoice/Asset/MonospaceAsset.php
    - src/Invoice/Entity/DeliveryParty.php

build:
  image: default-bionic

  environment:
    php:
      version: 8.1.13
      ini:
        xdebug.mode: develop

  nodes:
    analysis:
      project_setup:
        override:
          - 'true'
      tests:
        override:
          - php-scrutinizer-run
          -
            command: phpcs-run
            use_website_config: true            
          - js-scrutinizer-run
    tests: true

The only adjustment I have made is under checks php: with duplication: and unused parameters: set both to true and I have included - js-scrutinizer-run under tests: overide: as I would like duplication code in the javascript to be removed as well.

I have not used coverage under 'php: ini:' because I am not implementing unit testing. See

rossaddison commented 3 weeks ago

Lesson learned: Ensure there is a .scrutinizer.yml in the repo before inspection and I suspect one is not needed initially in the Default Configuration initially.

rossaddison commented 3 weeks ago

After having battled trying to get rid of vendor/bin/phpunit reverted back to simplified version.

Adding - js-scrutinizer-run to simplified version of scrutinizer.yml on rossaddison/invoice.

scrutinizer-ci.com panel replies with 3 configs: 1) checkout which matches rossaddison/invoice .scrutinizer.yml as it stands with the added js change. 2) repository which is my previous configuration on rossaddison/invoice. 3) global which corresponds to the following file:

checks:
    php:
        duplication: true
        unused_parameters: true
        verify_property_names: false
        verify_argument_usable_as_reference: false
        verify_access_scope_valid: false
        variable_existence: false
        useless_calls: false
        use_statement_alias_conflict: false
        unused_variables: false
        unused_properties: false
        unused_methods: false
        unreachable_code: false
        too_many_arguments: false
        symfony_request_injection: false
        switch_fallthrough_commented: false
        sql_injection_vulnerabilities: false
        security_vulnerabilities: false
        return_in_constructor: false
        require_scope_for_methods: false
        require_php_tag_first: false
        property_assignments: false
        precedence_mistakes: false
        precedence_in_conditions: false
        parse_doc_comments: false
        parameter_non_unique: false
        overriding_private_members: false
        overriding_parameter: false
        non_commented_empty_catch_block: false
        no_trait_type_hints: false
        no_trailing_whitespace: false
        no_short_open_tag: false
        no_property_on_interface: false
        no_non_implemented_abstract_methods: false
        no_exit: false
        no_eval: false
        no_error_suppression: false
        no_debug_code: false
        missing_arguments: false
        method_calls_on_non_object: false
        instanceof_class_exists: false
        foreach_usable_as_reference: false
        foreach_traversable: false
        fix_doc_comments: false
        encourage_shallow_comparison: false
        deprecated_code_usage: false
        deadlock_detection_in_loops: false
        comparison_always_same_result: false
        code_rating: false
        closure_use_not_conflicting: false
        closure_use_modifiable: false
        catch_class_exists: false
        call_to_parent_method: false
        avoid_superglobals: false
        avoid_length_functions_in_loops: false
        avoid_entity_manager_injection: false
        avoid_duplicate_types: false
        avoid_closing_tag: false
        assignment_of_null_return: false
        argument_type_checks: false

filter:
  paths:
    - src/Invoice
build:
  image: default-bionic
  environment:
    php:
      version: 8.1.13
      ini:
        xdebug.mode: develop
  nodes:
    analysis:
            tests:
                override:
                    - php-scrutinizer-run
                    -
                        command: phpcs-run
                        use_website_config: true

Now passing. I will make incremental changes to the simplest/simplified version.

rossaddison commented 3 weeks ago

Added two simple php checks to the simplified version.

checks:
  php:
    duplication: true
    unused_parameters: true

Been waiting .... say 3 minutes on

image

Test has gone through and passed.

rossaddison commented 3 weeks ago

Updated scrutinizer.yml with excluded paths but failed because of:

image

filter:
  paths:
    - src/Invoice

excluded_paths:      <-------- simple error --- should be tabbed to the right and appear directly under paths.
rossaddison commented 3 weeks ago

Updated scrutinizer.yml with dependency_paths:

scrutinizer-ci.com reponds with 3 configs: 1) checkout config i.e. rossaddison/invoice scrutinizer-ci.yml 2) repository which reflects the first simplified version. 3) global which has remain unchanged.

rossaddison commented 3 weeks ago

Included:

command: phpcs-run
            use_website_config: true

under

nodes:
    analysis:
      tests:
        override:
          - php-scrutinizer-run
          -
            command: phpcs-run
            use_website_config: true
          - js-scrutinizer-run

so that open-source analysis tool configs can be included, for example, rules regarding xml files.

image

rossaddison commented 3 weeks ago
  1. The coverage command has been included with xdebug.mode for future files that may be included.
  2. Further more intricate php checks may be added.