You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/03/05 01:17:45 UTC
[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #2982: tools/nxstyle: Verify relative path in the file header
patacongo commented on a change in pull request #2982:
URL: https://github.com/apache/incubator-nuttx/pull/2982#discussion_r587954289
##########
File path: tools/nxstyle.c
##########
@@ -831,6 +831,57 @@ int main(int argc, char **argv, char **envp)
ERROR("Missing file header comment block", lineno, 1);
}
+ if (lineno == 2)
+ {
+ if (line[n] == '*' && line[n + 1] == '\n')
+ {
+ ERROR("Missing relative file path in file header", lineno,
+ n);
+ }
+ else if (isspace(line[n + 2]))
+ {
+ ERROR("Too many whitespaces before relative file path",
+ lineno, n);
+ }
+ else
+ {
+ bool file_header_mismatch = false;
+
+ /* Checking whether g_file_name has the absolute path to
+ * the file.
+ * NOTE: Assuming that the project root folder name is
+ * "nuttx".
+ */
+
+ const char *root_substr = "/nuttx/";
+ char *basedir = strstr(g_file_name, root_substr);
Review comment:
Doesn't this assume that the name of the root directory is nuttx/? That is not always the case.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org