Ticket #9951 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Add pylint as part of static analysis checks

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: major Milestone: Release 3.3
Component: Python Keywords: Maintenance
Cc: Blocked By:
Blocking: Tester: Owen Arnold

Description

Pylint is is a python code analysis tool. It reports errors along similar lines to cppcheck.

This ticket will cover adding the configuration files to be able to setup a job that can run pylint on the buildservers and by developers.

Change History

comment:1 Changed 6 years ago by Martyn Gigg

Add a high-level script for pylint on files or directories.

It doesn't support directories yet. Refs #9951

Changeset: b3567be867cad9bfceed57f140d32a1cbf1b4e4a

comment:2 Changed 6 years ago by Martyn Gigg

Add a basic config file that outputs in text.

Refs #9951

Changeset: 14bcdef909945160afdaa48f0d8f6ceeaff180fd

comment:3 Changed 6 years ago by Martyn Gigg

Add cmake files to find pylint

Refs #9951

Changeset: 6234a8d4c2962e06880091ea621746b153ce4c76

comment:4 Changed 6 years ago by Nick Draper

  • Status changed from new to assigned

comment:5 Changed 6 years ago by Martyn Gigg

  • Status changed from assigned to inprogress

Add option to specify MANTIDPATH to linting script.

Refs #9951

Changeset: 829617882864ea66806b6eec8b832ab6fd67001f

comment:6 Changed 6 years ago by Martyn Gigg

Select directories to run pylint through cmake.

More consistent with how cppcheck is run. Refs #9951

Changeset: c39f113796a31863a753dd63b68f6126941ee0d2

comment:7 Changed 6 years ago by Martyn Gigg

Allow a list of excluded paths for pylint.

Refs #9951

Changeset: 73487d34603ce5c39e4826a889d311014ac174aa

comment:8 Changed 6 years ago by Martyn Gigg

Turn off warning about undefined variable

This mostly comes up with functions from mantid.simpleapi because they are generated and not static. Refs #9951

Changeset: b85041dd57d735ac8f1c17a0f24e512650bd7625

comment:9 Changed 6 years ago by Martyn Gigg

Flip default log level back to warning.

Refs #9951

Changeset: 81089b692d4c5829f6ce10a318939d747cee0228

comment:10 Changed 6 years ago by Martyn Gigg

Disable a few more warnings and add descriptions of those disabled.

Refs #9951

Changeset: 33d7eeb66c278be82db853fa35efc69c3311f738

comment:11 Changed 6 years ago by Martyn Gigg

Add an option to always return a 0 exit code.

Refs #9951

Changeset: 8b49720d98ae5283f8c816888fba1ca3da2dc92d

comment:12 Changed 6 years ago by Martyn Gigg

Require a minimum version of pylint.

Refs #9951

Changeset: d5efc8f52eccee3865c41ab4addff94d0c07ba90

comment:13 Changed 6 years ago by Martyn Gigg

  • Status changed from inprogress to verify
  • Resolution set to fixed

Branch: feature/9951_add_pylint_config

Tester: The code now contains a script and a build target to run pylint on selected parts of the Python code, as long as version >= 1.0.0 of pylint is installed. There is a separate static analysis job, http://builds.mantidproject.org/view/Static%20Analysis/job/pylint_develop/, that polls the repository every two hours for changes and runs the checks. To build on your local machine do

pip install pylint

Separate tickets will be created to attempt to deal with the ~30000 issues!

comment:14 Changed 6 years ago by Owen Arnold

  • Status changed from verify to verifying
  • Tester set to Owen Arnold

comment:15 Changed 6 years ago by Owen Arnold

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/9951_add_pylint_config'

Full changeset: 3e6379adf05f833f649acfe94215bad820cc07a0

comment:16 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10793

Note: See TracTickets for help on using tickets.