GithubHelp home page GithubHelp logo

idanpa / vscode-checkpatch Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 4.0 109 KB

Visual Studio Code extension for using linux kernel checkpatch tool to lint code.

Home Page: https://marketplace.visualstudio.com/items?itemName=idanp.checkpatch

License: MIT License

TypeScript 100.00%
vscode-extension checkpatch lint linux linux-kernel-checkpatch

vscode-checkpatch's Introduction

Checkpatch Lint

Visual Studio Code extension for using linux kernel checkpatch tool to lint code.

Installation

checkpatch.pl script should be either exposed through $PATH or pointed out by the checkpatch.checkpatchPath configuration.

sudo wget -O /usr/bin/checkpatch.pl "https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl"
sudo wget -O /usr/bin/spelling.txt "https://raw.githubusercontent.com/torvalds/linux/master/scripts/spelling.txt"
sudo chmod 755 /usr/bin/checkpatch.pl

Windows

cmd as administrator:

curl -o %WINDIR%/System32/checkpatch.pl "https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl"
curl -o %WINDIR%/System32/spelling.txt "https://raw.githubusercontent.com/torvalds/linux/master/scripts/spelling.txt"

On windows, a perl interpreter should also be installed - tested with ActivePerl Community Edition.
*.pl files should be configured to be opened by the interpreter by default (double click on any *.pl file and choose ActivePerl as the default program). GNU 'diff' executable should also be available (can be done by installing git-for-windows and adding it to PATH).

Commands

  • checkpatch.checkFile Check selected file (if the run mode is manual)
  • checkpatch.checkCommit Select specific commit to be tested
  • checkpatch.toggleAutoRun Toggle automatic checkpatch for the current workspace

Settings

  • checkpatch.checkpatchPath Path to the checkpatch.pl script
  • checkpatch.checkpatchArgs checkpatch arguments to use
  • checkpatch.run Control whether the linting is automatic on save or manually triggered using the checkpatch.checkFile command.
  • checkpatch.exclude Glob patterns for excluding files and folders from automatic checks.
  • checkpatch.diagnosticLevel Diagnostic level of checkpatch errors.

vscode-checkpatch's People

Contributors

dependabot[bot] avatar idanpa avatar nunojsa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-checkpatch's Issues

No output from checkpatch plugin on problems pane

Hi @idanpa ,

Thank you for making this plugin available for us.

After finishing the installation and invoking the plugin on a open C source file, no output seen on the editor (problems pane).

I got it working after disabling/enabling it several times.

Closing and opening again vscode causes the same issue again.

I'm not sure if there is a specific requirement to get it working.

Thanks
Maro

Is it still alive? Some advantages are needed.

Hi, @idanpa and thank you for the extension!

So, long story short, I need this to have some additional features:

  • support log parsing when there --showfile option is passed to the checkpatch
  • support a possibility to define a particular cwd for multiroot workspaces to make checkpatch use a config from specific workspace

I'm not a person who familiar with js, ts or vscode-extensions creation. But I can provide a pull-request where I'll try to do my best to implement these features. It may violate typical codestyle or common sense for ts, though.

Now, some details.

The idea behind the first feature is to implement an alternative parseCheckpatchLog() function (or addition to it) which may handle a different output from checkpatch. For comparison:

WARNING:LINUX_VERSION_CODE: LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged
#124: FILE: mac.c:124:
+#if KERNEL_VERSION(5, 8, 1) <= LINUX_VERSION_CODE

- this style of logs is supported for now.

mac.c:124: WARNING:LINUX_VERSION_CODE: LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged
+#if KERNEL_VERSION(5, 8, 1) <= LINUX_VERSION_CODE

- This style I want to be supported (here --showfile option was passed to checkpatch).

About second feature. I think it would be good to define some option that a user can define inside settings.json of a particular workspace, and then extension should use this workspace as cwd, but not the root. I don't know if this possible or some other approach should be choosen. Of course this related to the Checkpatch Selected File feature.

I need some feedback for it from you,
Cheers.

Please consider publishing to https://open-vsx.org/

Hi,

While large parts of VS Code are developed as open source, the actual product is not open source.
There are many actual open source projects that support VS Code extensions, but only Microsoft products can use and connect to Microsoft’s Extension Marketplace. The terms of use for the Marketplace prevent any non-Visual Studio products from accessing it.

It would be great if this project were to be published at https://open-vsx.org/, an open source extension registry at the Eclipse Foundation, a vendor-neutral organization.

You can read more at https://www.eclipse.org/community/eclipse_newsletter/2020/march/1.php

Thanks for the extension!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.