Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-3132

S1451: FP when pragma is before license header

    XMLWordPrintable

    Details

    • Sprint:
      Balazs Onboarding

      Description

      An issue is raised in the following code snippet (with use of regex copyright [0-9]{4}):

      #pragma once
      // copyright 2018
      
      void foo();
      

      Because #pragma once is written before the license header.
      The same behavior will happen with include guards.

      This false positive appeared after the implementation of CPP-2513 that was done to improve the performances of the rule (by not comparing the regex to the whole content of the file, but only to the first lines).

      So we need to fix this false positive while keeping the performances of the rule under control (eg: by checking the x first lines of the file)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              amelie.renard Amélie Renard
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: