test_class.declarator: RULE_ID1 = "ANSIBLE1"
test_class.modifier: private static final
test_class.original_string: private static final String RULE_ID1 = "ANSIBLE1";
test_class.type: String
test_class.var_name: RULE_ID1
test_class.declarator: RULE_ID2 = "EAnyCheck1"
test_class.modifier: private static final
test_class.original_string: private static final String RULE_ID2 = "EAnyCheck1";
test_class.type: String
test_class.var_name: RULE_ID2
test_class.declarator: RULE_ID3 = "EAnyCheck2"
test_class.modifier: private static final
test_class.original_string: private static final String RULE_ID3 = "EAnyCheck2";
test_class.type: String
test_class.var_name: RULE_ID3
test_class.declarator: ruleKey1 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID1)
test_class.modifier: private final
test_class.original_string: private final RuleKey ruleKey1 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID1);
test_class.type: RuleKey
test_class.var_name: ruleKey1
test_class.declarator: ruleKey2 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID2)
test_class.modifier: private final
test_class.original_string: private final RuleKey ruleKey2 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID2);
test_class.type: RuleKey
test_class.var_name: ruleKey2
test_class.declarator: ruleKey3 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID3)
test_class.modifier: private final
test_class.original_string: private final RuleKey ruleKey3 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID3);
test_class.type: RuleKey
test_class.var_name: ruleKey3
test_class.declarator: sensor
test_class.modifier: private
test_class.original_string: private MySensor sensor;
test_class.type: MySensor
test_class.var_name: sensor
test_class.declarator: context
test_class.modifier: private
test_class.original_string: private SensorContextTester context;
test_class.type: SensorContextTester
test_class.var_name: context
test_class.declarator: temporaryFolder = new TemporaryFolder()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public TemporaryFolder temporaryFolder = new TemporaryFolder();
test_class.type: TemporaryFolder
test_class.var_name: temporaryFolder
test_class.declarator: logTester = new LogTester()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public LogTester logTester = new LogTester();
test_class.type: LogTester
test_class.var_name: logTester
test_class.file: sonar-ansible-api/src/test/java/com/github/sbaudoin/sonar/plugins/ansible/rules/AbstractAnsibleSensorTest.java
test_class.identifier: AbstractAnsibleSensorTest
test_case.body: @Test
      public void testSaveIssue() throws IOException {
          InputFile playbook = Utils.getInputFile("playbooks/playbook1.yml");
  
          // Try to save issue for an unknown rule
          logTester.clear();
          sensor.saveIssue(context, playbook, 2, "foo", "An error here");
          assertEquals(1, logTester.logs(LoggerLevel.DEBUG).size());
          assertEquals("Rule foo ignored, not found in repository", logTester.logs(LoggerLevel.DEBUG).get(0));
  
          // Save issue for a known rule
          logTester.clear();
          sensor.saveIssue(context, playbook, 2, RULE_ID2, "An error here");
          assertEquals(1, context.allIssues().size());
          Issue issue = (Issue)context.allIssues().toArray()[0];
          assertEquals(ruleKey2, issue.ruleKey());
          IssueLocation location = issue.primaryLocation();
          assertEquals(playbook.key(), location.inputComponent().key());
          assertEquals(2, location.textRange().start().line());
          assertEquals("An error here", location.message());
      }
test_case.class_method_signature: AbstractAnsibleSensorTest.testSaveIssue()
test_case.full_signature: @Test public void testSaveIssue()
test_case.identifier: testSaveIssue
test_case.invocations: getInputFile clear saveIssue assertEquals size logs assertEquals get logs clear saveIssue assertEquals size allIssues toArray allIssues assertEquals ruleKey primaryLocation assertEquals key key inputComponent assertEquals line start textRange assertEquals message
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSaveIssue()
focal_class.declarator: LOGGER = Loggers.get(AbstractAnsibleSensor.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Loggers.get(AbstractAnsibleSensor.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: fileSystem
focal_class.modifier: protected final
focal_class.original_string: protected final FileSystem fileSystem;
focal_class.type: FileSystem
focal_class.var_name: fileSystem
focal_class.declarator: mainFilesPredicate
focal_class.modifier: protected final
focal_class.original_string: protected final FilePredicate mainFilesPredicate;
focal_class.type: FilePredicate
focal_class.var_name: mainFilesPredicate
focal_class.declarator: allIssues = new HashMap<>()
focal_class.modifier: protected final
focal_class.original_string: protected final Map<URI, Set<String>> allIssues = new HashMap<>();
focal_class.type: Map<URI, Set<String>>
focal_class.var_name: allIssues
focal_class.declarator: scannedFiles = new HashSet<>()
focal_class.modifier: protected final
focal_class.original_string: protected final Set<InputFile> scannedFiles = new HashSet<>();
focal_class.type: Set<InputFile>
focal_class.var_name: scannedFiles
focal_class.file: sonar-ansible-api/src/main/java/com/github/sbaudoin/sonar/plugins/ansible/rules/AbstractAnsibleSensor.java
focal_class.identifier: AbstractAnsibleSensor
focal_class.interfaces: implements Sensor
focal_class.class_method_signature: AbstractAnsibleSensor.AbstractAnsibleSensor(FileSystem fileSystem)
focal_class.full_signature: protected  AbstractAnsibleSensor(FileSystem fileSystem)
focal_class.identifier: AbstractAnsibleSensor
focal_class.modifiers: protected
focal_class.parameters: (FileSystem fileSystem)
focal_class.signature:  AbstractAnsibleSensor(FileSystem fileSystem)
focal_class.class_method_signature: AbstractAnsibleSensor.executeWithAnsibleLint(SensorContext context, @Nullable List<String> extraAnsibleLintArgs)
focal_class.full_signature: protected void executeWithAnsibleLint(SensorContext context, @Nullable List<String> extraAnsibleLintArgs)
focal_class.identifier: executeWithAnsibleLint
focal_class.modifiers: protected
focal_class.parameters: (SensorContext context, @Nullable List<String> extraAnsibleLintArgs)
focal_class.return: void
focal_class.signature: void executeWithAnsibleLint(SensorContext context, @Nullable List<String> extraAnsibleLintArgs)
focal_class.class_method_signature: AbstractAnsibleSensor.getAnsibleLintPath(SensorContext context)
focal_class.full_signature: protected String getAnsibleLintPath(SensorContext context)
focal_class.identifier: getAnsibleLintPath
focal_class.modifiers: protected
focal_class.parameters: (SensorContext context)
focal_class.return: String
focal_class.signature: String getAnsibleLintPath(SensorContext context)
focal_class.class_method_signature: AbstractAnsibleSensor.getAnsibleLintConfPath(SensorContext context)
focal_class.full_signature: protected String getAnsibleLintConfPath(SensorContext context)
focal_class.identifier: getAnsibleLintConfPath
focal_class.modifiers: protected
focal_class.parameters: (SensorContext context)
focal_class.return: String
focal_class.signature: String getAnsibleLintConfPath(SensorContext context)
focal_class.class_method_signature: AbstractAnsibleSensor.executeCommand(List<String> command, List<String> stdOut, List<String> errOut)
focal_class.full_signature: protected int executeCommand(List<String> command, List<String> stdOut, List<String> errOut)
focal_class.identifier: executeCommand
focal_class.modifiers: protected
focal_class.parameters: (List<String> command, List<String> stdOut, List<String> errOut)
focal_class.return: int
focal_class.signature: int executeCommand(List<String> command, List<String> stdOut, List<String> errOut)
focal_class.class_method_signature: AbstractAnsibleSensor.registerIssue(String rawIssue)
focal_class.full_signature: protected boolean registerIssue(String rawIssue)
focal_class.identifier: registerIssue
focal_class.modifiers: protected
focal_class.parameters: (String rawIssue)
focal_class.return: boolean
focal_class.signature: boolean registerIssue(String rawIssue)
focal_class.class_method_signature: AbstractAnsibleSensor.saveIssues(SensorContext context)
focal_class.full_signature: protected void saveIssues(SensorContext context)
focal_class.identifier: saveIssues
focal_class.modifiers: protected
focal_class.parameters: (SensorContext context)
focal_class.return: void
focal_class.signature: void saveIssues(SensorContext context)
focal_class.class_method_signature: AbstractAnsibleSensor.saveIssue(SensorContext context, InputFile inputFile, int line, String ruleId, String message)
focal_class.full_signature: protected void saveIssue(SensorContext context, InputFile inputFile, int line, String ruleId, String message)
focal_class.identifier: saveIssue
focal_class.modifiers: protected
focal_class.parameters: (SensorContext context, InputFile inputFile, int line, String ruleId, String message)
focal_class.return: void
focal_class.signature: void saveIssue(SensorContext context, InputFile inputFile, int line, String ruleId, String message)
focal_class.class_method_signature: AbstractAnsibleSensor.getRuleKey(SensorContext context, String ruleId)
focal_class.full_signature: protected RuleKey getRuleKey(SensorContext context, String ruleId)
focal_class.identifier: getRuleKey
focal_class.modifiers: protected
focal_class.parameters: (SensorContext context, String ruleId)
focal_class.return: RuleKey
focal_class.signature: RuleKey getRuleKey(SensorContext context, String ruleId)
focal_method.body: protected void saveIssue(SensorContext context, InputFile inputFile, int line, String ruleId, String message) {
          RuleKey ruleKey = getRuleKey(context, ruleId);
  
          // Old rules (ansible-lint < 3.5) had id ANSIBLE... but now it is E... so we may need to add the heading E back
          if (ruleKey == null) {
              ruleKey = getRuleKey(context, "E" + ruleId);
          }
  
          if (ruleKey == null) {
              LOGGER.debug("Rule " + ruleId + " ignored, not found in repository");
              return;
          }
  
          NewIssue newIssue = context.newIssue().forRule(ruleKey);
          NewIssueLocation location = newIssue.newLocation()
                  .on(inputFile)
                  .message(message)
                  .at(inputFile.selectLine(line));
          newIssue.at(location).save();
          LOGGER.debug("Issue {} saved for {}", ruleId, inputFile.filename());
      }
focal_method.class_method_signature: AbstractAnsibleSensor.saveIssue(SensorContext context, InputFile inputFile, int line, String ruleId, String message)
focal_method.full_signature: protected void saveIssue(SensorContext context, InputFile inputFile, int line, String ruleId, String message)
focal_method.identifier: saveIssue
focal_method.invocations: getRuleKey getRuleKey debug forRule newIssue at message on newLocation selectLine save at debug filename
focal_method.modifiers: protected
focal_method.parameters: (SensorContext context, InputFile inputFile, int line, String ruleId, String message)
focal_method.return: void
focal_method.signature: void saveIssue(SensorContext context, InputFile inputFile, int line, String ruleId, String message)