Skip to content

Commit

Permalink
Fix documentation format warnings (see FlexBE#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
pschillinger authored and LoyVanBeek committed Mar 30, 2020
1 parent 2b96bf0 commit 079bdfd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
33 changes: 21 additions & 12 deletions src/io/io_packageparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,29 @@ IO.PackageParser = new (function() {
} else if (import_path != undefined) {
if (path.extname(entry) == ".py" && path.basename(entry) != "__init__.py") {
IO.Filesystem.readFile(entry, (content) => {
var imports = entry.replace(import_path+"/", "").replace(/.py$/i, "").replace(/[\/]/g, ".");
IO.StateParser.parseState(content, imports, state_def => {
if (state_def != undefined) {
state_def.setFilePath(entry);
if (WS.Statelib.getFromLib(state_def.getStateType())) {
WS.Statelib.updateDef(state_def);
} else {
WS.Statelib.addToLib(state_def);
try {
var imports = entry.replace(import_path+"/", "").replace(/.py$/i, "").replace(/[\/]/g, ".");
IO.StateParser.parseState(content, imports, state_def => {
try {
if (state_def != undefined) {
state_def.setFilePath(entry);
if (WS.Statelib.getFromLib(state_def.getStateType())) {
WS.Statelib.updateDef(state_def);
} else {
WS.Statelib.addToLib(state_def);
}
state_defs.push(state_def);
watchStateFolder(folder, import_path);
}
} catch (error) {
console.error(error);
}
state_defs.push(state_def);
watchStateFolder(folder, import_path);
}
processEntry(idx + 1);
});
} catch (error) {
console.error(error);
processEntry(idx + 1);
});
}
});
} else {
processEntry(idx + 1);
Expand Down
4 changes: 2 additions & 2 deletions src/io/io_stateparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ for data in iter(sys.stdin.readline, ""):
if (last_argument != undefined) argument_doc.push(last_argument);
var arg_split = l.match(/^(--|>#|#>)\s+([^\s]+)\s+([^\s]+)\s+(.+)$/);
if (arg_split == null || arg_split.length < 5) {
T.logWarn('Entry in ' + state_class + ' does not fit documentation format: ' + l);
T.logWarn('Entry does not fit documentation format: ' + l);
} else {
last_argument = {
symbol: arg_split[1],
Expand All @@ -302,7 +302,7 @@ for data in iter(sys.stdin.readline, ""):
if (last_argument != undefined) argument_doc.push(last_argument);
var arg_split = l.match(/^(<=)\s+([^\s]+)\s+(.+)$/);
if (arg_split == null || arg_split.length < 4) {
T.logWarn('Entry in ' + state_class + ' does not fit documentation format: ' + l);
T.logWarn('Entry does not fit documentation format: ' + l);
} else {
last_argument = {
symbol: arg_split[1],
Expand Down

0 comments on commit 079bdfd

Please sign in to comment.