Skip to content

Commit

Permalink
CodeShield to use absolute imports
Browse files Browse the repository at this point in the history
Reviewed By: laurendeason, lisroach

Differential Revision: D67810408

fbshipit-source-id: d2354f6dbcee234f3c1bab69e925f46cb169f7d9
  • Loading branch information
SimonWan authored and facebook-github-bot committed Jan 29, 2025
1 parent e923bdf commit 5717126
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 28 deletions.
9 changes: 5 additions & 4 deletions CodeShield/codeshield.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
import logging
from dataclasses import dataclass

from .insecure_code_detector import insecure_code_detector, languages
from .insecure_code_detector.issues import Issue, Severity
from .insecure_code_detector.languages import Language
from .insecure_code_detector.usecases import UseCase
from CodeShield.insecure_code_detector import insecure_code_detector, languages

from CodeShield.insecure_code_detector.issues import Issue, Severity
from CodeShield.insecure_code_detector.languages import Language
from CodeShield.insecure_code_detector.usecases import UseCase

LOG: logging.Logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import unittest
from abc import ABC

from .. import insecure_code_detector
from ..languages import Language
from CodeShield.insecure_code_detector import insecure_code_detector
from CodeShield.insecure_code_detector.languages import Language

try:
from ..internal import oss
from CodeShield.insecure_code_detector.internal import oss
except ImportError:
from .. import oss
from CodeShield.insecure_code_detector import oss


class InsecureCodeDetectorTest(unittest.IsolatedAsyncioTestCase, ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
8 changes: 4 additions & 4 deletions CodeShield/insecure_code_detector/tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

import unittest

from .. import insecure_code_detector
from ..languages import Language
from CodeShield.insecure_code_detector import insecure_code_detector
from CodeShield.insecure_code_detector.languages import Language

try:
from ..internal import oss
from CodeShield.insecure_code_detector.internal import oss
except ImportError:
from .. import oss
from CodeShield.insecure_code_detector import oss

# the following test cases contain an input string, the insecure pattern match line number, and the expected rule
C_REGEX_TEST_CASES = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

PHP_TEST_CASES = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# pyre-strict


from ..languages import Language
from CodeShield.insecure_code_detector.languages import Language

from .insecure_code_detector_test import InsecureCodeDetectorTest

# the following test cases contain an input string, and the corresponding number of expected insecure pattern matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

from pathlib import Path

from tqdm import tqdm
from CodeShield.insecure_code_detector import insecure_code_detector
from CodeShield.insecure_code_detector.languages import Language

from ...CodeShield.insecure_code_detector import insecure_code_detector
from ...CodeShield.insecure_code_detector.languages import Language
from tqdm import tqdm

from .benchmark import Benchmark
from .bleu import compute_bleu_score
Expand Down

0 comments on commit 5717126

Please sign in to comment.