@Override
 public ImmutableList<Note> analyze(ShipshapeContext shipshapeContext) throws AnalyzerException {
   Note note =
       Note.newBuilder()
           .setCategory(CATEGORY)
           .setDescription(POST_MESSAGE)
           .setLocation(
               Location.newBuilder().setSourceContext(shipshapeContext.getSourceContext()))
           .build();
   return ImmutableList.of(note);
 }
    @Override
    public void onDescribed(Description description) {
      SourceContext sourceContext = shipshapeContext.getSourceContext();

      // Create a TextRange to mark where the problem occurred.
      JCTree treeNode = (JCTree) description.node;
      Position.LineMap lineMap = compilationUnit.getLineMap();
      TextRange textRange =
          TextRange.newBuilder()
              .setStartLine(lineMap.getLineNumber(treeNode.getStartPosition()))
              .setStartColumn(lineMap.getColumnNumber(treeNode.getStartPosition()))
              .setEndLine(
                  lineMap.getLineNumber(treeNode.getEndPosition(compilationUnit.endPositions)))
              .setEndColumn(
                  lineMap.getColumnNumber(treeNode.getEndPosition(compilationUnit.endPositions)))
              .build();

      // Create a Note for this problem.
      Note.Builder noteBuilder =
          Note.newBuilder()
              .setDescription(description.getMessageWithoutCheckName())
              .setCategory(CATEGORY)
              .setSubcategory(description.checkName)
              .setLocation(
                  Location.newBuilder()
                      .setPath(path)
                      .setRange(textRange)
                      .setSourceContext(sourceContext));

      // If the source is available, create fix protos for the problem.
      if (source != null) {
        try {
          EncodingOffsetConverter encodingOffsetConverter =
              new EncodingOffsetConverter(source, Charset.forName(encoding));
          FixAndReplacementConverter translator =
              new FixAndReplacementConverter(
                  path, sourceContext, encodingOffsetConverter, compilationUnit);
          for (int i = 0; i < description.fixes.size(); i++) {
            Fix errorProneFix = description.fixes.get(i);
            NotesProto.Fix fix =
                translator.fromErrorProneFix(
                    errorProneFix,
                    String.format(
                        "Fix #%d for error-prone %s warning", i + 1, description.checkName));
            noteBuilder.addFix(fix);
          }
        } catch (UnsupportedEncodingException e) {
          logger.info("Cannot convert to byte index", shipshapeContext, CATEGORY);
        }
      }
      notes.add(noteBuilder.build());
    }