Skip to content

Commit

Permalink
Suppress unwanted errors
Browse files Browse the repository at this point in the history
When there are multiple revisions of an imported module, they are all parsed, and the logic to suppress errors fails to suppress them from the revisions that aren't selected for import. This fix works around this.
  • Loading branch information
wlupton authored and mbj4668 committed Oct 7, 2020
1 parent a2065a1 commit 9e68b15
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/pyang
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@ Validates the YANG module in <filename> (or stdin), and all its dependencies."""
if etag in o.ignore_error_tags:
continue
if (ctx.implicit_errors is False and
hasattr(epos.top, 'i_modulename') and
epos.top.arg not in modulenames and
epos.top.i_modulename not in modulenames and
(not hasattr(epos.top, 'i_modulename') or
epos.top.i_modulename not in modulenames) and
epos.ref not in filenames):
# this module was added implicitly (by import); skip this error
# the code includes submodules
Expand Down
4 changes: 4 additions & 0 deletions test/test_issues/test_i680/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test: test1

test1:
-$(PYANG) --max-line-len=70 -f tree -o mod1.tree mod1.yang 2>&1 | diff mod1.expect -
Empty file.
4 changes: 4 additions & 0 deletions test/test_issues/test_i680/mod1.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

module: mod1
augment /m2:a:
+--rw b
13 changes: 13 additions & 0 deletions test/test_issues/test_i680/mod1.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module mod1 {
yang-version 1.1;
namespace "urn:mod1";
prefix m1;

import mod2 {
prefix m2;
}

augment "/m2:a" {
container b {}
}
}
1 change: 1 addition & 0 deletions test/test_issues/test_i680/mod2.yang
13 changes: 13 additions & 0 deletions test/test_issues/test_i680/mod2@2020-10-06.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module mod2 {
yang-version 1.1;
namespace "urn:mod2";
prefix m2;

revision 2020-10-06;

container a {
description
"This line is rather over-long, and therefore will trigger a warning with
--max-line-length=70.";
}
}

0 comments on commit 9e68b15

Please sign in to comment.