snorben / EEG_preprocessing_UMCU

Apache License 2.0
1 stars 0 forks source link

Formatting and linting #10

Open github-actions[bot] opened 4 months ago

github-actions[bot] commented 4 months ago

It is helpful for reviewers/contributors if you adhere to a standard python style guide. There is a package called ruff that can help you fix up your code to adhere to these.

Install ruff using pip install ruff and then you can run ruff format to automatically format your files against their (black standards, which is aligned with the the most common formatting standards (called black).

You can also run ruff check to help you lint the files.

DaniBodor commented 2 months ago

Linting and formatting are related yet different tasks. I found it hard to explain the difference, so asked ChatGPT, and it gave a great answer:

In Python (and other programming languages), formatting and linting are related to code quality and style, but they serve different purposes:

1. Formatting

Formatting refers to the process of arranging and styling code according to specific rules or conventions. This includes things like indentation, spacing, line length, and other stylistic choices that make code easier to read and maintain. Formatting tools automatically adjust your code to meet these conventions.

Examples of formatting tasks:

Popular formatting tools in Python:

2. Linting

Linting refers to the process of analyzing code to identify potential errors, bugs, stylistic errors, or other problematic patterns. Linters provide feedback on code quality, adherence to best practices, and can catch potential bugs before the code is run.

Examples of linting tasks:

Popular linting tools in Python:

Key Differences

Both formatting and linting are essential for maintaining high-quality, readable, and reliable code.