linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nigel Christian <nigel.l.christian@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: hverkuil-cisco@xs4all.nl, mchehab@kernel.org,
	sakari.ailus@linux.intel.com, gustavoars@kernel.org,
	linux-media@vger.kernel.org, trivial@kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] media: cec: fix trivial style warnings
Date: Fri, 18 Dec 2020 07:35:58 -0500	[thread overview]
Message-ID: <20201218123558.GA4088@fedora> (raw)
In-Reply-To: <20201218101630.GM2831@kadam>

On Fri, Dec 18, 2020 at 01:16:30PM +0300, Dan Carpenter wrote:
> On Fri, Dec 18, 2020 at 01:31:17AM -0500, Nigel Christian wrote:
> > Comment has 'then' repeated twice. Let's clean it up.
> > Use unsigned int to maintain naming consistency.
> > 
> 
> Do you use a tool to find the double "then then"?
> 
> regards,
> dan carpenter
> 

Started working on nodejs script to run the 'checkpatch.pl -f'
on directories and filter the output by command line arg.
It goes in scripts/ and is run from the root of the kernel.
Let me know if there is any modification that can make it
more effective or specific filters.
------------------
'use strict'
// place this file in kernel 'scripts' directory
const pfs = require('fs').promises
const { spawn } = require('child_process')
const dir = process.argv[2]
const lvl = process.argv[3]
const path = `./${dir}`
const checkPatch = './scripts/checkpatch.pl -f'
const badInput = dir === undefined || dir === null || dir === ''
                || lvl === undefined || lvl === null || lvl === ''

/**
 * Check for valid command line arguments
 */
if(badInput) {
    console.log('Run checkpatch.pl on directories')
    console.log('Usage: node ./scripts/checkdirpatch <path/to/check>'
    + ' <LEVEL> (e.g. WARNING or ERROR)')
    process.exit(1)
} else {
    console.log(`Reading path ${path}...`)
}

/**
 * Async function for running checkpatch.pl on entire directory
 * We won't drill down any further from here and only check for
 * files at the current directory. Output is controlled via the 
 * log level which is passed as command line argument
 */
async function check() {
    const files = await pfs.readdir(path).then(v => v)
    files.forEach(async f => {
        const stat = await pfs.lstat(`${path}${f}`)
        if(stat.isFile()) {
            const child = spawn(`${checkPatch} ${path}${f} | grep -A1 ${lvl}`, {
                shell: true,
                stdio: ['pipe', 'inherit', 'ignore']
            })
        }
    })
}
check().catch(e => console.error(e))
--------------------------------------------

https://github.com/callmekurisu/kernel-dev/blob/main/checkdirpatch.js


Thanks, 

Nigel

  reply	other threads:[~2020-12-18 12:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18  6:31 [PATCH] media: cec: fix trivial style warnings Nigel Christian
2020-12-18 10:16 ` Dan Carpenter
2020-12-18 12:35   ` Nigel Christian [this message]
2020-12-18 13:36     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201218123558.GA4088@fedora \
    --to=nigel.l.christian@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gustavoars@kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).