antiagainst / codeclimate-cppcheck

Code Climate Engine for Cppcheck
MIT License
27 stars 17 forks source link

fail to append --inline-suppr option for cppcheck #46

Closed alundilong closed 1 year ago

alundilong commented 2 years ago

if statement in command.py should be like, image

https://github.com/antiagainst/codeclimate-cppcheck/blob/1c1977e1716519c2d998399b0dfb980726dea122/lib/command.py#L49

jeffstjean commented 2 years ago

+1 to this as it's making this plugin unusable for our use case.

My config looks like this:

version: "2"
plugins: 
  cppcheck:
    enabled: true
    config:
      check: all
      debug: true
      language: c
      stds:
        - c11
      inline-suppr: true

And it's clear the option isn't enabled in the command:

D, [2022-10-06T01:35:53.083608 #1] DEBUG -- : /config.json content: {"enabled"=>true, "config"=>{"check"=>"all", "debug"=>true, "language"=>"c", "stds"=>["c11"], "inline-suppr"=>true}, "channel"=>"stable", "include_paths"=>[{ removed }], "debug"=>"1"}
D, [2022-10-06T01:35:53.084039 #1] DEBUG -- : docker run: ["docker", "run", "--name", "cc-engines-cppcheck-stable-e133a445-f5eb-4ee6-be31-5fea2e6693a1", "--cap-drop", "all", "--label", "com.codeclimate.label=a3a03c8c-e355-42a1-bd69-9883b9732b4e", "--log-driver", "none", "--memory-swap", "-1", "--net", "none", "--rm", "--volume", "{ removed }", "--volume", "/tmp/cc/33611a0e-0df5-4e2c-9763-7e42c8a029d8:/config.json:ro", "--user", "9000:9000", "--memory", "1024000000", "codeclimate/codeclimate-cppcheck"]
D, [2022-10-06T01:35:53.923484 #1] DEBUG -- : engine stderr: [cppcheck] config: {'enabled': True, 'config': {'check': 'all', 'debug': True, 'language': 'c', 'stds': ['c11'], 'inline-suppr': True}, 'channel': 'stable', 'include_paths': [{ removed }], 'debug': '1'}
nmasseyKM commented 2 years ago

I'm seeing the same behavior as above. Additionally, modifying the config to look like

plugins:
  cppcheck:
    enabled: true
    config:
        inline-suppr: 'true'

does cause the value to be passed as a string, but it still does not propagate to the command line

jeffstjean commented 2 years ago

Is this repo still supported? I'm using this for Gitlab's static analysis on MRs and I don't have the ability to change where Gitlab pulls the image from

antiagainst commented 2 years ago

Hey thanks for the report! Unfortunately I don't have time to maintain it right now; if anybody is willing to manage it, I'd happy to facilitate!

alexdelifer commented 1 year ago

This should be fixed now, can you try by running the following?

git clone https://github.com/antiagainst/codeclimate-cppcheck
cd codeclimate-cppcheck
docker build . -t codeclimate/codeclimate-cppcheck:latest

Then use codeclimate like usual

alexdelifer commented 1 year ago

Fixed in master, please reopen if you still experience this bug.

We're trying to get the dockerhub image updated. In the mean time, you'll have to build the image yourself to get the fix.