Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lizard tool is failing unit test. #521

Closed
tdenewiler opened this issue Feb 7, 2025 · 1 comment
Closed

Lizard tool is failing unit test. #521

tdenewiler opened this issue Feb 7, 2025 · 1 comment

Comments

@tdenewiler
Copy link
Contributor

In the latest weekly workflow, the lizard tool is failing a unit test.

  =================================== FAILURES ===================================
  ______________________ test_lizard_tool_plugin_scan_valid ______________________
  
      def test_lizard_tool_plugin_scan_valid():
          """Integration test: Make sure the lizard output hasn't changed."""
          ltp = setup_lizard_tool_plugin()
          if not ltp.command_exists("lizard"):
              pytest.skip("Can't find lizard, unable to test lizard plugin")
      
          package = Package(
              "valid_package", os.path.join(os.path.dirname(__file__), "valid_package")
          )
          package["src_dir"] = os.path.join(os.path.dirname(__file__), "valid_package")
  >       issues = ltp.scan(package, "level")
  
  ../tests/plugins/tool/lizard/test_lizard_tool_plugin.py:62: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  ../src/statick_tool/plugins/tool/lizard.py:58: in scan
      printer(result, options, schema, lizard.AllResult)
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  
  code_infos = <map object at 0x105be7040>
  option = Namespace(paths=['/Users/runner/work/statick/statick/tests/plugins/tool/lizard/valid_package'], languages=[], verbose=...ds={'cyclomatic_complexity': 15, 'length': 1000, 'nloc': 1000000, 'parameter_count': 100}, whitelist='whitelizard.txt')
  scheme = <lizard.OutputScheme object at 0x105e51110>
  _ = <class 'lizard.AllResult'>
  
      def print_clang_style_warning(code_infos, option, scheme, _):
          count = 0
          for warning in get_warnings(code_infos, option):
  >           print(scheme.clang_warning_format().format(f=warning))
  E           AttributeError: 'FunctionInfo' object has no attribute 'max_nesting_depth'

We have seen this in other projects this week. One cause might be the update from 1.17.10 to 1.17.17. Along with that, a potential fix was found by removing our hard-coding addition of the -w flag when running the lizard tool from within our plugin.

My initial thought for a fix is to remove the hard-coding of the -w flag. Anyone who needs/wants to use that flag can add it in the Statick configuration file. Whether adding -w in the Statick configuration file would lead to the same issue has not been tested yet. If this is the approach we go with, unit tests should help determine if we will not catch some issues that we caught with the -w flag.

@tdenewiler
Copy link
Contributor Author

Posted at lizard: terryyin/lizard#407.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant