Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Compilation Database to handle different configuration sources in an unique way #1970

Merged
merged 1 commit into from
Nov 1, 2020

Conversation

guwirth
Copy link
Collaborator

@guwirth guwirth commented Nov 1, 2020

Combine squid configuration to one solution, see #1365

To analyze source code additional information like defines and includes are needed. Only then it is possible for the preprocessor and parser to generate an complete abstract syntax tree.

The solution allows to store information as key/value pairs. The information is also arranged hierarchically. If an information is not found on one level, the next higher level is searched. Additional information can be e.g. on file level (translation unit), global or from sonar-project.properties.

Pre-defined hierarchy (levels):

PredefinedMacros
|-- SonarProjectProperties
     |-- Global
          |-- Files
                |-- File
                |-- File
                |-- ...

With add the key/value pairs are added to the database. The level parameter defines the level on which the data should be inserted. For level a predefined name can be used or a new one can be defined. If level is an identifier, the information is created in an element with the level-name directly under root. If level is a path, the information is stored on Files level.

With get and getValues the information is read out again afterwards. get returns the first found value for key, whereby the search starts on level. getValues collects all found values over all levels. It starts with the given level and further found values are added to the end of the list.

close #1365
close #1325
close #1326


This change is Reviewable

@guwirth guwirth added this to the 2.0.0 milestone Nov 1, 2020
@guwirth guwirth self-assigned this Nov 1, 2020
@guwirth guwirth force-pushed the CompilationDatabase branch from dbeba59 to 5796697 Compare November 1, 2020 13:22
@ghost
Copy link

ghost commented Nov 1, 2020

DeepCode's analysis on #579669 found:

  • ℹ️ 1 minor issue. 👇
  • ✔️ 1 issue was fixed.

Top issues

Description Example fixes
Use java.util.ArrayList instead of java.util.LinkedList. Using java.util.LinkedList can lead to unnecessary performance overhead if the list is randomly accessed. Occurrences: 🔧 Example fixes

👉 View analysis in DeepCode’s Dashboard | Configure the bot

@guwirth guwirth merged commit 2ca240f into SonarOpenCommunity:master Nov 1, 2020
@guwirth guwirth deleted the CompilationDatabase branch November 30, 2020 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment