Skip to content

Commit

Permalink
Merge pull request #4089 from whisperity/feat/show-zero-checkers/patch
Browse files Browse the repository at this point in the history
feat(server): Store information about available checkers to the database
  • Loading branch information
vodorok authored Mar 1, 2024
2 parents 3dab96d + f4a8089 commit b544c58
Show file tree
Hide file tree
Showing 42 changed files with 1,847 additions and 574 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ jobs:
run: sh .github/workflows/install-deps.sh

- name: Init .pgpass
if: matrix.database != 'sqlite'
run: |
echo '*:*:*:*:postgres' > $HOME/.pgpass
chmod 0600 $HOME/.pgpass
Expand All @@ -163,7 +164,10 @@ jobs:
env:
PGPASSWORD: postgres
run: |
export PGPASSFILE=$HOME/.pgpass
if [[ "${{ matrix.database != 'sqlite' }}" == "true" ]]
then
export PGPASSFILE=$HOME/.pgpass
fi
make pip_dev_deps
pip3 install -r web/requirements_py/auth/requirements.txt
Expand Down
35 changes: 0 additions & 35 deletions alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,3 @@ script_location = web/server/codechecker_server/migrations/report

sqlalchemy.url = postgres://postgres@localhost:5432/default
#sqlalchemy.url = sqlite:////home/username/.codechecker/Default.sqlite

# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console
qualname =

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[logger_alembic]
level = INFO
handlers =
qualname = alembic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
7 changes: 7 additions & 0 deletions analyzer/tests/unit/test_checker_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ def initialize_labels_dir(self):
def test_checker_labels(self):
cl = CheckerLabels(self.labels_dir.name)

self.assertEqual(
sorted(cl.get_analyzers()),
sorted([
"clang-tidy",
"clangsa"
]))

self.assertEqual(
sorted(cl.checkers_by_labels([
'profile:extreme'])),
Expand Down
13 changes: 11 additions & 2 deletions codechecker_common/checker_labels.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import os
# -------------------------------------------------------------------------
#
# Part of the CodeChecker project, under the Apache License v2.0 with
# LLVM Exceptions. See LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# -------------------------------------------------------------------------
from collections import defaultdict

import os
from typing import Any, cast, DefaultDict, Dict, Iterable, List, Optional, \
Set, Tuple, Union

Expand Down Expand Up @@ -148,6 +154,9 @@ def __get_analyzer_data(
if analyzer is None or a == analyzer:
yield a, c

def get_analyzers(self) -> Iterable[str]:
return self.__data.keys()

def checkers_by_labels(
self,
filter_labels: Iterable[str],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
import logging
import os

from typing import Callable, Dict, List, Optional, Protocol, Set
from typing import Callable, Dict, List, Optional, Protocol, Set, Tuple

from .. import util


LOG = logging.getLogger('report-converter')

FakeChecker: Tuple[str, str] = ("__FAKE__", "__FAKE__")
UnknownChecker: Tuple[str, str] = ("UNKNOWN", "NOT FOUND")


class SkipListHandlers(Protocol):
should_skip: Callable[[str], bool]
Expand Down Expand Up @@ -338,8 +341,8 @@ def __init__(
self.severity = severity
self.report_hash = report_hash
self.analyzer_name = analyzer_name
self.category = category
self.type = type
self.category = category # TODO: Remove this. DEPRECATED.
self.type = type # TODO: Remove this. DEPRECATED.
self.annotations = annotations

self.static_message = \
Expand Down Expand Up @@ -488,7 +491,13 @@ def to_json(self) -> Dict:
"severity": self.severity,
"report_hash": self.report_hash,
"analyzer_name": self.analyzer_name,
# DEPRECATED: 'category' is deprecated in 6.24.0, as it is not
# parsed, understood, or handled by the report server.
# It should be removed!
"category": self.category,
# DEPRECATED: 'type' is deprecated in 6.24.0, as it is not
# parsed, understood, or handled by the report server.
# It should be removed!
"type": self.type,
"review_status": self.review_status.status
if self.review_status else '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@
else:
from mypy_extensions import TypedDict

from codechecker_report_converter.report import BugPathEvent, \
BugPathPosition, File, get_or_create_file, MacroExpansion, Range, Report
from codechecker_report_converter.report import \
BugPathEvent, BugPathPosition, \
File, \
MacroExpansion, \
Range, Report, \
UnknownChecker, \
get_or_create_file
from codechecker_report_converter.report.hash import get_report_hash, HashType
from codechecker_report_converter.report.parser.base import AnalyzerInfo, \
BaseParser, get_tool_info
Expand Down Expand Up @@ -242,8 +247,8 @@ def __create_report(
files: Dict[int, File],
metadata: Dict[str, Any]
) -> Report:
location = diag.get('location', {})
checker_name = diag.get('check_name', "unknown")
location = diag.get("location", {})
checker_name = diag.get("check_name", UnknownChecker[1])
analyzer_name = self.__get_analyzer_name(checker_name, metadata)
severity = self.get_severity(checker_name)

Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion web/api/js/codechecker-api-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codechecker-api",
"version": "6.54.0",
"version": "6.55.0",
"description": "Generated node.js compatible API stubs for CodeChecker server.",
"main": "lib",
"homepage": "https://github.com/Ericsson/codechecker",
Expand Down
Binary file modified web/api/py/codechecker_api/dist/codechecker_api.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion web/api/py/codechecker_api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('README.md', encoding='utf-8', errors="ignore") as f:
long_description = f.read()

api_version = '6.54.0'
api_version = '6.55.0'

setup(
name='codechecker_api',
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion web/api/py/codechecker_api_shared/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('README.md', encoding='utf-8', errors="ignore") as f:
long_description = f.read()

api_version = '6.54.0'
api_version = '6.55.0'

setup(
name='codechecker_api_shared',
Expand Down
17 changes: 13 additions & 4 deletions web/api/report_server.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ struct RunHistoryData {
4: string user, // User name who analysed the run.
5: string time, // Date time when the run was analysed.
6: i64 id, // Id of the run history tag.
7: string checkCommand, // Check command. !!!DEPRECATED!!! This field will be empty so use the getCheckCommand API function to get the check command for a run.
// !!!DEPRECATED!!! This field will be empty so use the getCheckCommand() API function to get the check command for a run.
7: string checkCommand,
8: string codeCheckerVersion, // CodeChecker client version of the latest analysis.
9: AnalyzerStatisticsData analyzerStatistics, // Statistics for analyzers. Only number of failed and successfully analyzed
// files field will be set. To get full analyzer statistics please use the
Expand Down Expand Up @@ -467,8 +468,16 @@ union AnalysisInfoFilter {
3: i64 reportId,
}

struct AnalysisInfoChecker {
1: bool enabled, // If the checker was enabled during the analysis.
}

struct AnalysisInfo {
1: string analyzerCommand,
1: string analyzerCommand,
// For each analyzer, the checkers and their status as was available during
// the analysis.
2: optional map<string, map<string,
AnalysisInfoChecker>> checkers,
}

typedef string CommitHash
Expand Down Expand Up @@ -534,12 +543,12 @@ service codeCheckerDBAccess {

// Get check command for a run.
// PERMISSION: PRODUCT_VIEW
// !DEPRECATED Use getAnalysisInfo API to get the check commands.
// !DEPRECATED Use getAnalysisInfo() API to get the check commands.
string getCheckCommand(1: i64 runHistoryId,
2: i64 runId)
throws (1: codechecker_api_shared.RequestFailed requestError),

// Get analyzer commands based on the given filters.
// Get analyzer execution information based on the given filters.
// PERMISSION: PRODUCT_VIEW
list<AnalysisInfo> getAnalysisInfo(1: AnalysisInfoFilter analysisInfoFilter,
2: i64 limit,
Expand Down
2 changes: 1 addition & 1 deletion web/codechecker_web/shared/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# The newest supported minor version (value) for each supported major version
# (key) in this particular build.
SUPPORTED_VERSIONS = {
6: 54
6: 55
}

# Used by the client to automatically identify the latest major and minor
Expand Down
Loading

0 comments on commit b544c58

Please sign in to comment.