gustavonihei commented on a change in pull request #2982:
URL: https://github.com/apache/incubator-nuttx/pull/2982#discussion_r588618424



##########
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:
       Suppose the relative file path in the comment is `tools/nxstle.c`
   This condition will not be satisfied because `g_file_name[base - 1]` will 
point to the 't' character.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to