* [PATCH] checkpatch: warn if changed lines exceeds a maximum size
@ 2018-01-30 15:57 Brown, Nicholas
2018-01-30 16:10 ` Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: Brown, Nicholas @ 2018-01-30 15:57 UTC (permalink / raw)
To: joe@perches.com, linux-kernel@vger.kernel.org, apw@canonical.com
Changed lines is the total of inserted and deleted lines.
By default there is no limit, --max-changed-lines may be used to set a
value. Some users may wish to encourage that patches are split into
smaller parts using this.
See Documentation/process/submitting-patches.rst#split-changes
Signed-off-by: Nicholas Brown <nick.brown@att.com>
---
scripts/checkpatch.pl | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 31031f10fe56..1217d782b6bb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -49,6 +49,7 @@ my @ignore = ();
my $help = 0;
my $configuration_file = ".checkpatch.conf";
my $max_line_length = 80;
+my $max_changed_lines; # undef = no max
my $ignore_perl_version = 0;
my $minimum_perl_version = 5.10.0;
my $min_conf_desc_length = 4;
@@ -209,6 +210,7 @@ GetOptions(
'show-types!' => \$show_types,
'list-types!' => \$list_types,
'max-line-length=i' => \$max_line_length,
+ 'max-changed-lines=i' => \$max_changed_lines,
'min-conf-desc-length=i' => \$min_conf_desc_length,
'root=s' => \$root,
'summary!' => \$summary,
@@ -2165,6 +2167,8 @@ sub process {
my $filename = shift;
my $linenr=0;
+ my $inserted_lines_total=0;
+ my $deleted_lines_total=0;
my $prevline="";
my $prevrawline="";
my $stashline="";
@@ -2233,6 +2237,14 @@ sub process {
push(@fixed, $rawline) if ($fix);
+ if ($rawline=~/^\+/) {
+ $inserted_lines_total++
+ }
+
+ if ($rawline=~/^-/) {
+ $deleted_lines_total++
+ }
+
if ($rawline=~/^\+\+\+\s+(\S+)/) {
$setup_docs = 0;
if ($1 =~ m@Documentation/admin-guide/kernel-parameters.rst$@) {
@@ -2306,6 +2318,11 @@ sub process {
$prefix = '';
+ if (defined $max_changed_lines &&
+ ($inserted_lines_total+$deleted_lines_total > $max_changed_lines)) {
+ WARN("MAX_CHANGED_LINES", "please split the change into smaller parts\n");
+ }
+
$realcnt = 0;
$linenr = 0;
$fixlinenr = -1;
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH] checkpatch: warn if changed lines exceeds a maximum size
2018-01-30 15:57 [PATCH] checkpatch: warn if changed lines exceeds a maximum size Brown, Nicholas
@ 2018-01-30 16:10 ` Joe Perches
2018-01-30 18:04 ` Brown, Nicholas
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2018-01-30 16:10 UTC (permalink / raw)
To: Brown, Nicholas, linux-kernel@vger.kernel.org, apw@canonical.com
On Tue, 2018-01-30 at 15:57 +0000, Brown, Nicholas wrote:
> Changed lines is the total of inserted and deleted lines.
> By default there is no limit, --max-changed-lines may be used to set a
> value. Some users may wish to encourage that patches are split into
> smaller parts using this.
> See Documentation/process/submitting-patches.rst#split-changes
(This patch seems whitespace damaged)
I don't care for this much as is either.
This patch doesn't add help text and it
should probably add a check for
"if (!$file"
so new files aren't size limited.
Also, it double counts lines that are
added and deleted so doing things like
refactoring a block of code into a new
separate function would potentially trip
this.
> Signed-off-by: Nicholas Brown <nick.brown@att.com>
> ---
> scripts/checkpatch.pl | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 31031f10fe56..1217d782b6bb 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -49,6 +49,7 @@ my @ignore = ();
> my $help = 0;
> my $configuration_file = ".checkpatch.conf";
> my $max_line_length = 80;
> +my $max_changed_lines; # undef = no max
> my $ignore_perl_version = 0;
> my $minimum_perl_version = 5.10.0;
> my $min_conf_desc_length = 4;
> @@ -209,6 +210,7 @@ GetOptions(
> 'show-types!' => \$show_types,
> 'list-types!' => \$list_types,
> 'max-line-length=i' => \$max_line_length,
> + 'max-changed-lines=i' => \$max_changed_lines,
> 'min-conf-desc-length=i' => \$min_conf_desc_length,
> 'root=s' => \$root,
> 'summary!' => \$summary,
> @@ -2165,6 +2167,8 @@ sub process {
> my $filename = shift;
>
> my $linenr=0;
> + my $inserted_lines_total=0;
> + my $deleted_lines_total=0;
> my $prevline="";
> my $prevrawline="";
> my $stashline="";
> @@ -2233,6 +2237,14 @@ sub process {
>
> push(@fixed, $rawline) if ($fix);
>
> + if ($rawline=~/^\+/) {
> + $inserted_lines_total++
> + }
> +
> + if ($rawline=~/^-/) {
> + $deleted_lines_total++
> + }
> +
> if ($rawline=~/^\+\+\+\s+(\S+)/) {
> $setup_docs = 0;
> if ($1 =~ m@Documentation/admin-guide/kernel-parameters.rst$@) {
> @@ -2306,6 +2318,11 @@ sub process {
>
> $prefix = '';
>
> + if (defined $max_changed_lines &&
> + ($inserted_lines_total+$deleted_lines_total > $max_changed_lines)) {
> + WARN("MAX_CHANGED_LINES", "please split the change into smaller parts\n");
> + }
> +
> $realcnt = 0;
> $linenr = 0;
> $fixlinenr = -1;
> --
> 2.14.1
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] checkpatch: warn if changed lines exceeds a maximum size
2018-01-30 16:10 ` Joe Perches
@ 2018-01-30 18:04 ` Brown, Nicholas
2018-01-30 19:01 ` Nicholas Brown
0 siblings, 1 reply; 11+ messages in thread
From: Brown, Nicholas @ 2018-01-30 18:04 UTC (permalink / raw)
To: joe@perches.com, linux-kernel@vger.kernel.org, apw@canonical.com
On Tue, 2018-01-30 at 08:10 -0800, Joe Perches wrote:
> On Tue, 2018-01-30 at 15:57 +0000, Brown, Nicholas wrote:
> > Changed lines is the total of inserted and deleted lines.
> > By default there is no limit, --max-changed-lines may be used to
> > set a
> > value. Some users may wish to encourage that patches are split into
> > smaller parts using this.
> > See Documentation/process/submitting-patches.rst#split-changes
>
> (This patch seems whitespace damaged)
>
> I don't care for this much as is either.
>
> This patch doesn't add help text and it
I'll look to add some help text.
> should probably add a check for
> "if (!$file"
> so new files aren't size limited.
>
> Also, it double counts lines that are
> added and deleted so doing things like
> refactoring a block of code into a new
> separate function would potentially trip
> this.
These were both intentional. Large new files are just as equal a
potential target for splitting as a large change to a file, and could
for example add basic infra/stubs in an initial patch, and then flesh
out implementation in follow up patches.
Similarly it counts both insertions and deletions, as it's the
cumulative total that's a better measure of change, as compared
(insertions - deletions) which could be for example 0 while cumulative
total is large.
By making the --max-changed-lines completely user defined, with no
default, it's left to individual developers/maintainers to determine
what they consider a meaningful value is to represent a "large change"
to warn on for splitting a patch.
Thanks,
Nick
>
> > Signed-off-by: Nicholas Brown <nick.brown@att.com>
> > ---
> > scripts/checkpatch.pl | 17 +++++++++++++++++
> > 1 file changed, 17 insertions(+)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 31031f10fe56..1217d782b6bb 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -49,6 +49,7 @@ my @ignore = ();
> > my $help = 0;
> > my $configuration_file = ".checkpatch.conf";
> > my $max_line_length = 80;
> > +my $max_changed_lines; # undef = no max
> > my $ignore_perl_version = 0;
> > my $minimum_perl_version = 5.10.0;
> > my $min_conf_desc_length = 4;
> > @@ -209,6 +210,7 @@ GetOptions(
> > 'show-types!' => \$show_types,
> > 'list-types!' => \$list_types,
> > 'max-line-length=i' => \$max_line_length,
> > + 'max-changed-lines=i' => \$max_changed_lines,
> > 'min-conf-desc-length=i' => \$min_conf_desc_length,
> > 'root=s' => \$root,
> > 'summary!' => \$summary,
> > @@ -2165,6 +2167,8 @@ sub process {
> > my $filename = shift;
> >
> > my $linenr=0;
> > + my $inserted_lines_total=0;
> > + my $deleted_lines_total=0;
> > my $prevline="";
> > my $prevrawline="";
> > my $stashline="";
> > @@ -2233,6 +2237,14 @@ sub process {
> >
> > push(@fixed, $rawline) if ($fix);
> >
> > + if ($rawline=~/^\+/) {
> > + $inserted_lines_total++
> > + }
> > +
> > + if ($rawline=~/^-/) {
> > + $deleted_lines_total++
> > + }
> > +
> > if ($rawline=~/^\+\+\+\s+(\S+)/) {
> > $setup_docs = 0;
> > if ($1 =~ m@Documentation/admin-
> > guide/kernel-parameters.rst$@) {
> > @@ -2306,6 +2318,11 @@ sub process {
> >
> > $prefix = '';
> >
> > + if (defined $max_changed_lines &&
> > + ($inserted_lines_total+$deleted_lines_total >
> > $max_changed_lines)) {
> > + WARN("MAX_CHANGED_LINES", "please split the change into
> > smaller parts\n");
> > + }
> > +
> > $realcnt = 0;
> > $linenr = 0;
> > $fixlinenr = -1;
> > --
> > 2.14.1
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH] checkpatch: warn if changed lines exceeds a maximum size
2018-01-30 18:04 ` Brown, Nicholas
@ 2018-01-30 19:01 ` Nicholas Brown
2018-01-30 19:09 ` Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: Nicholas Brown @ 2018-01-30 19:01 UTC (permalink / raw)
To: apw, joe; +Cc: linux-kernel, Nicholas Brown
Changed lines is the total of inserted and deleted lines.
By default there is no limit, --max-changed-lines may be used to set a
value. Some users may wish to encourage that patches are split into
smaller parts using this.
See Documentation/process/submitting-patches.rst#split-changes
Signed-off-by: Nicholas Brown <nick.brown@att.com>
---
scripts/checkpatch.pl | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 31031f10fe56..2847109b4def 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -49,6 +49,7 @@ my @ignore = ();
my $help = 0;
my $configuration_file = ".checkpatch.conf";
my $max_line_length = 80;
+my $max_changed_lines; # undef = no max
my $ignore_perl_version = 0;
my $minimum_perl_version = 5.10.0;
my $min_conf_desc_length = 4;
@@ -92,6 +93,8 @@ Options:
--ignore TYPE(,TYPE2...) ignore various comma separated message types
--show-types show the specific message type in the output
--max-line-length=n set the maximum line length, if exceeded, warn
+ --max-changed-lines=n set the maximum number of changed lines allowed,
+ if exceeded, warn. (insertions + deletions)
--min-conf-desc-length=n set the min description length, if shorter, warn
--root=PATH PATH to the kernel tree root
--no-summary suppress the per-file summary
@@ -209,6 +212,7 @@ GetOptions(
'show-types!' => \$show_types,
'list-types!' => \$list_types,
'max-line-length=i' => \$max_line_length,
+ 'max-changed-lines=i' => \$max_changed_lines,
'min-conf-desc-length=i' => \$min_conf_desc_length,
'root=s' => \$root,
'summary!' => \$summary,
@@ -2165,6 +2169,8 @@ sub process {
my $filename = shift;
my $linenr=0;
+ my $inserted_lines_total=0;
+ my $deleted_lines_total=0;
my $prevline="";
my $prevrawline="";
my $stashline="";
@@ -2233,6 +2239,14 @@ sub process {
push(@fixed, $rawline) if ($fix);
+ if ($rawline=~/^\+/) {
+ $inserted_lines_total++
+ }
+
+ if ($rawline=~/^-/) {
+ $deleted_lines_total++
+ }
+
if ($rawline=~/^\+\+\+\s+(\S+)/) {
$setup_docs = 0;
if ($1 =~ m@Documentation/admin-guide/kernel-parameters.rst$@) {
@@ -2306,6 +2320,11 @@ sub process {
$prefix = '';
+ if (defined $max_changed_lines &&
+ ($inserted_lines_total+$deleted_lines_total > $max_changed_lines)) {
+ WARN("MAX_CHANGED_LINES", "please split the change into smaller parts\n");
+ }
+
$realcnt = 0;
$linenr = 0;
$fixlinenr = -1;
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH] checkpatch: warn if changed lines exceeds a maximum size
2018-01-30 19:01 ` Nicholas Brown
@ 2018-01-30 19:09 ` Joe Perches
2018-01-30 20:25 ` Brown, Nicholas
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2018-01-30 19:09 UTC (permalink / raw)
To: Nicholas Brown, apw; +Cc: linux-kernel, Nicholas Brown
On Tue, 2018-01-30 at 19:01 +0000, Nicholas Brown wrote:
> Changed lines is the total of inserted and deleted lines.
> By default there is no limit, --max-changed-lines may be used to set a
> value. Some users may wish to encourage that patches are split into
> smaller parts using this.
> See Documentation/process/submitting-patches.rst#split-changes
Still whitespace damaged.
Indentations use tabs not 2 spaces.
and another issue below
> Signed-off-by: Nicholas Brown <nick.brown@att.com>
> ---
> scripts/checkpatch.pl | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 31031f10fe56..2847109b4def 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -49,6 +49,7 @@ my @ignore = ();
> my $help = 0;
> my $configuration_file = ".checkpatch.conf";
> my $max_line_length = 80;
> +my $max_changed_lines; # undef = no max
> my $ignore_perl_version = 0;
> my $minimum_perl_version = 5.10.0;
> my $min_conf_desc_length = 4;
> @@ -92,6 +93,8 @@ Options:
> --ignore TYPE(,TYPE2...) ignore various comma separated message types
> --show-types show the specific message type in the output
> --max-line-length=n set the maximum line length, if exceeded, warn
> + --max-changed-lines=n set the maximum number of changed lines allowed,
> + if exceeded, warn. (insertions + deletions)
> --min-conf-desc-length=n set the min description length, if shorter, warn
> --root=PATH PATH to the kernel tree root
> --no-summary suppress the per-file summary
> @@ -209,6 +212,7 @@ GetOptions(
> 'show-types!' => \$show_types,
> 'list-types!' => \$list_types,
> 'max-line-length=i' => \$max_line_length,
> + 'max-changed-lines=i' => \$max_changed_lines,
> 'min-conf-desc-length=i' => \$min_conf_desc_length,
> 'root=s' => \$root,
> 'summary!' => \$summary,
> @@ -2165,6 +2169,8 @@ sub process {
> my $filename = shift;
>
> my $linenr=0;
> + my $inserted_lines_total=0;
> + my $deleted_lines_total=0;
> my $prevline="";
> my $prevrawline="";
> my $stashline="";
> @@ -2233,6 +2239,14 @@ sub process {
>
> push(@fixed, $rawline) if ($fix);
>
> + if ($rawline=~/^\+/) {
> + $inserted_lines_total++
This counts patch header blocks with \+\+\+
> + }
> +
> + if ($rawline=~/^-/) {
> + $deleted_lines_total++
> + }
and \-\-\-
> +
> if ($rawline=~/^\+\+\+\s+(\S+)/) {
> $setup_docs = 0;
> if ($1 =~ m@Documentation/admin-guide/kernel-parameters.rst$@) {
> @@ -2306,6 +2320,11 @@ sub process {
>
> $prefix = '';
>
> + if (defined $max_changed_lines &&
> + ($inserted_lines_total+$deleted_lines_total > $max_changed_lines)) {
> + WARN("MAX_CHANGED_LINES", "please split the change into smaller parts\n");
> + }
> +
> $realcnt = 0;
> $linenr = 0;
> $fixlinenr = -1;
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] checkpatch: warn if changed lines exceeds a maximum size
2018-01-30 19:09 ` Joe Perches
@ 2018-01-30 20:25 ` Brown, Nicholas
2018-01-30 20:26 ` Nicholas Brown
0 siblings, 1 reply; 11+ messages in thread
From: Brown, Nicholas @ 2018-01-30 20:25 UTC (permalink / raw)
To: joe@perches.com, apw@canonical.com, nickbroon@gmail.com
Cc: linux-kernel@vger.kernel.org
On Tue, 2018-01-30 at 11:09 -0800, Joe Perches wrote:
> On Tue, 2018-01-30 at 19:01 +0000, Nicholas Brown wrote:
> > Changed lines is the total of inserted and deleted lines.
> > By default there is no limit, --max-changed-lines may be used to
> > set a
> > value. Some users may wish to encourage that patches are split into
> > smaller parts using this.
> > See Documentation/process/submitting-patches.rst#split-changes
>
> Still whitespace damaged.
> Indentations use tabs not 2 spaces.
Hopefully editor set correctly now, so follow-up should fix this.
>
> and another issue below
>
> >
> > @@ -2233,6 +2239,14 @@ sub process {
> >
> > push(@fixed, $rawline) if ($fix);
> >
> > + if ($rawline=~/^\+/) {
> > + $inserted_lines_total++
>
> This counts patch header blocks with \+\+\+
Good catch. Will fix.
>
> > + }
> > +
> > + if ($rawline=~/^-/) {
> > + $deleted_lines_total++
> > + }
>
> and \-\-\-
Ditto.
Thanks, Nick
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH] checkpatch: warn if changed lines exceeds a maximum size
2018-01-30 20:25 ` Brown, Nicholas
@ 2018-01-30 20:26 ` Nicholas Brown
[not found] ` <1517481518.3063.92.camel@intl.att.com>
0 siblings, 1 reply; 11+ messages in thread
From: Nicholas Brown @ 2018-01-30 20:26 UTC (permalink / raw)
To: apw, joe; +Cc: linux-kernel, Nicholas Brown
Changed lines is the total of inserted and deleted lines.
By default there is no limit, --max-changed-lines may be used to set a
value. Some users may wish to encourage that patches are split into
smaller parts using this.
See Documentation/process/submitting-patches.rst#split-changes
Signed-off-by: Nicholas Brown <nick.brown@att.com>
---
scripts/checkpatch.pl | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 31031f10fe56..a71bc4f15ce7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -49,6 +49,7 @@ my @ignore = ();
my $help = 0;
my $configuration_file = ".checkpatch.conf";
my $max_line_length = 80;
+my $max_changed_lines; # undef = no max
my $ignore_perl_version = 0;
my $minimum_perl_version = 5.10.0;
my $min_conf_desc_length = 4;
@@ -92,6 +93,8 @@ Options:
--ignore TYPE(,TYPE2...) ignore various comma separated message types
--show-types show the specific message type in the output
--max-line-length=n set the maximum line length, if exceeded, warn
+ --max-changed-lines=n set the maximum number of changed lines allowed,
+ if exceeded, warn. (insertions + deletions)
--min-conf-desc-length=n set the min description length, if shorter, warn
--root=PATH PATH to the kernel tree root
--no-summary suppress the per-file summary
@@ -209,6 +212,7 @@ GetOptions(
'show-types!' => \$show_types,
'list-types!' => \$list_types,
'max-line-length=i' => \$max_line_length,
+ 'max-changed-lines=i' => \$max_changed_lines,
'min-conf-desc-length=i' => \$min_conf_desc_length,
'root=s' => \$root,
'summary!' => \$summary,
@@ -2165,6 +2169,8 @@ sub process {
my $filename = shift;
my $linenr=0;
+ my $inserted_lines_total=0;
+ my $deleted_lines_total=0;
my $prevline="";
my $prevrawline="";
my $stashline="";
@@ -2233,6 +2239,14 @@ sub process {
push(@fixed, $rawline) if ($fix);
+ if ($rawline=~/^\+/ && $rawline!~/^\+\+\+/) {
+ $inserted_lines_total++
+ }
+
+ if ($rawline=~/^-/ && $rawline!~/^---/) {
+ $deleted_lines_total++;
+ }
+
if ($rawline=~/^\+\+\+\s+(\S+)/) {
$setup_docs = 0;
if ($1 =~ m@Documentation/admin-guide/kernel-parameters.rst$@) {
@@ -2306,6 +2320,13 @@ sub process {
$prefix = '';
+ #print "inserted: $inserted_lines_total\n";
+ #print "deleted: $deleted_lines_total\n";
+ if (defined $max_changed_lines &&
+ ($inserted_lines_total+$deleted_lines_total > $max_changed_lines)) {
+ WARN("MAX_CHANGED_LINES", "please split the change into smaller parts\n");
+ }
+
$realcnt = 0;
$linenr = 0;
$fixlinenr = -1;
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] checkpatch: warn if changed lines exceeds a maximum size
@ 2018-01-30 15:04 Brown, Nicholas
0 siblings, 0 replies; 11+ messages in thread
From: Brown, Nicholas @ 2018-01-30 15:04 UTC (permalink / raw)
To: joe@perches.com, apw@canonical.com; +Cc: linux-kernel@vger.kernel.org
Changed lines is the total of inserted and deleted lines.
By default there is no limit, --max-changed-lines may be used to set a
value. Some users may wish to encourage that patches are split into
smaller parts using this.
See Documentation/process/submitting-patches.rst#split-changes
Signed-off-by: Nicholas Brown <nick.brown@att.com>
---
scripts/checkpatch.pl | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 31031f10fe56..1217d782b6bb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -49,6 +49,7 @@ my @ignore = ();
my $help = 0;
my $configuration_file = ".checkpatch.conf";
my $max_line_length = 80;
+my $max_changed_lines; # undef = no max
my $ignore_perl_version = 0;
my $minimum_perl_version = 5.10.0;
my $min_conf_desc_length = 4;
@@ -209,6 +210,7 @@ GetOptions(
'show-types!' => \$show_types,
'list-types!' => \$list_types,
'max-line-length=i' => \$max_line_length,
+ 'max-changed-lines=i' => \$max_changed_lines,
'min-conf-desc-length=i' => \$min_conf_desc_length,
'root=s' => \$root,
'summary!' => \$summary,
@@ -2165,6 +2167,8 @@ sub process {
my $filename = shift;
my $linenr=0;
+ my $inserted_lines_total=0;
+ my $deleted_lines_total=0;
my $prevline="";
my $prevrawline="";
my $stashline="";
@@ -2233,6 +2237,14 @@ sub process {
push(@fixed, $rawline) if ($fix);
+ if ($rawline=~/^\+/) {
+ $inserted_lines_total++
+ }
+
+ if ($rawline=~/^-/) {
+ $deleted_lines_total++
+ }
+
if ($rawline=~/^\+\+\+\s+(\S+)/) {
$setup_docs = 0;
if ($1 =~ m@Documentation/admin-guide/kernel-parameters.rst$@) {
@@ -2306,6 +2318,11 @@ sub process {
$prefix = '';
+ if (defined $max_changed_lines &&
+ ($inserted_lines_total+$deleted_lines_total > $max_changed_lines)) {
+ WARN("MAX_CHANGED_LINES", "please split the change into smaller parts\n");
+ }
+
$realcnt = 0;
$linenr = 0;
$fixlinenr = -1;
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-02-01 16:03 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-30 15:57 [PATCH] checkpatch: warn if changed lines exceeds a maximum size Brown, Nicholas
2018-01-30 16:10 ` Joe Perches
2018-01-30 18:04 ` Brown, Nicholas
2018-01-30 19:01 ` Nicholas Brown
2018-01-30 19:09 ` Joe Perches
2018-01-30 20:25 ` Brown, Nicholas
2018-01-30 20:26 ` Nicholas Brown
[not found] ` <1517481518.3063.92.camel@intl.att.com>
2018-02-01 12:54 ` Joe Perches
2018-02-01 15:42 ` Brown, Nicholas
2018-02-01 16:03 ` Jonathan Corbet
-- strict thread matches above, loose matches on Subject: below --
2018-01-30 15:04 Brown, Nicholas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox