Skip to content

Commit

Permalink
Chore: Mention support of linting in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
idillon-sfl committed Jul 16, 2024
1 parent 74ab5b2 commit 119c993
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,22 @@ Toaster users may start toaster through the **main context menu** -> **Bitbake**

> Note: Toaster requires additional packages and ports. It may not be compatible with all commandWrapper settings. Read the Toaster manual to configure them to have all the required dependencies.
### Linting
Linting is not directly handled by this extension. Users are advised to install other extensions that have these features. (e.g. [oelint-adv](https://marketplace.visualstudio.com/items?itemName=kweihmann.oelint-vscode)).

However, this extensions supports *optional* external VS Code extensions for Shell and Python linting. It does so by filtering and editing the linting errors produces by these extensions to ensure they are relevant to the BitBake context.

The supported external extensions:
- [Flake8](https://marketplace.visualstudio.com/items?itemName=ms-python.flake8) (Python)
- [Pylint](https://marketplace.visualstudio.com/items?itemName=ms-python.pylint) (Python)
- [shellcheck](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck) (Shell)

Please be aware of the [issues](./TROUBLESHOOTING.md#settings-are-being-ignored-on-flake8-and-pylint) and [trade-offs](./TROUBLESHOOTING.md#trade-offs-on-linting) related to linting.

## Troubleshooting
See the [TROUBLESHOOTING.md](./TROUBLESHOOTING.md) file.

## Others
This extension currently doesn't provide linting and formatting. Users are advised to install other extensions that have these features. (e.g. [oelint-adv](https://marketplace.visualstudio.com/items?itemName=kweihmann.oelint-vscode))

This extension also doesn't support WKS files, you should find another extension such as [openembedded-kickstart](https://marketplace.visualstudio.com/items?itemName=wickscc.openembedded-kickstart)
## Contributing

Expand Down
21 changes: 20 additions & 1 deletion TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ We haven't found a way to prevent these tabs from opening, but we try to close t

If this problem gets too annoying, consider activating the `bitbake.disableEmbeddedLanguagesFiles` setting.

# files.trimTrailingWhitespace does not work on Python and Shell files
### files.trimTrailingWhitespace does not work on Python and Shell files
When the extension is activated, `files.trimTrailingWhiteSpace` is deactivated for Python and Shell documents because this option interferes with the handling of Python and Shell code in BitBake documents.

In the background, some Python and Shell documents are made in order to handle Python and Shell languages in BitBake files. These documents contain a lot of trailing whitespaces. If `files.trimTrailingWhiteSpace` is activated, it will trim the whitespaces into these files, making it hard to map the positions between the generated files and the original BitBake file.
Expand Down Expand Up @@ -68,6 +68,9 @@ commit to your poky repository:

- https://git.yoctoproject.org/poky/commit/?id=fff242b5d21f9d856557ed9367fa43fa8b435be5

### Settings are being ignored on Flake8 and Pylint
Settings for Flake8 and Pylint do not work on BitBake files. In other words, they are not configurable. The reason for this issue is currently unknown.

## Trade-offs

### Trade-offs on Diagnostics
Expand All @@ -76,3 +79,19 @@ Some functionalities for [embedded Bash and Python code](https://code.visualstud
The related issues:
- [Problems from Unknown Files Appear in the Problems Tab](TROUBLESHOOTING.md#problems-from-unknown-files-appear-in-the-problems-tab)
- [Tabs from Unknown Files Open and Close Quickly](TROUBLESHOOTING.md#tabs-from-unknown-files-open-and-close-quickly)

### Trade-offs on linting
Since Flake8 and Pylint are intended to be used on Python files, it is necessary to analyse the context in which the errors are generated to determine if they still apply to the BitBake file. Unfortunately, some errors require complex analysis and our experiments showed performance issues. For this reason, these errors are currently being completely ignored.

The linting errors being completely ignored:

Flake8:
- E501 (Line too long)
- E203 (whitespace before ':')
- E211 (whitespace before '(')
- E302 (expected 2 blank lines, found 1)
- E303 (too many blank lines)

Pylint:
- W0104:pointless-statement
- W0106:expression-not-assigned

0 comments on commit 119c993

Please sign in to comment.