当前位置: 首页>>代码示例>>Java>>正文


Java Issue类代码示例

本文整理汇总了Java中com.android.tools.lint.detector.api.Issue的典型用法代码示例。如果您正苦于以下问题:Java Issue类的具体用法?Java Issue怎么用?Java Issue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Issue类属于com.android.tools.lint.detector.api包,在下文中一共展示了Issue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHighlighLevelAndInspection

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
@Nullable
public static Pair<AndroidLintInspectionBase, HighlightDisplayLevel> getHighlighLevelAndInspection(@NotNull Project project,
                                                                                                   @NotNull Issue issue,
                                                                                                   @NotNull PsiElement context) {
  final String inspectionShortName = AndroidLintInspectionBase.getInspectionShortNameByIssue(project, issue);
  if (inspectionShortName == null) {
    return null;
  }

  final HighlightDisplayKey key = HighlightDisplayKey.find(inspectionShortName);
  if (key == null) {
    return null;
  }

  final InspectionProfile profile = InspectionProjectProfileManager.getInstance(context.getProject()).getInspectionProfile();
  if (!profile.isToolEnabled(key, context)) {
    return null;
  }

  final AndroidLintInspectionBase inspection = (AndroidLintInspectionBase)profile.getUnwrappedTool(inspectionShortName, context);
  if (inspection == null) return null;
  final HighlightDisplayLevel errorLevel = profile.getErrorLevel(key, context);
  return Pair.create(inspection,
                     errorLevel != null ? errorLevel : HighlightDisplayLevel.WARNING);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AndroidLintUtil.java

示例2: getIssues

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
@Override
public List<Issue> getIssues() {
    System.out.println("********Custom Lint rules works!!!********");
    return Arrays.asList(
            LogUsageDetector.ISSUE,
            ToastUsageDetector.ISSUE,
            HandlerUsageDetector.ISSUE,
            ActivityFragmentLayoutNameDetector.ACTIVITY_LAYOUT_NAME_ISSUE,
            ActivityFragmentLayoutNameDetector.FRAGMENT_LAYOUT_NAME_ISSUE,
            ThrowExceptionDetector.ISSUE,
            MessageObtainDetector.ISSUE,
            ViewNamePrefixDetector.ISSUE,
            ForIfTryDepthDetector.TryDepthISSUE,
            ForIfTryDepthDetector.IfDepthISSUE,
            ForIfTryDepthDetector.ForDepthISSUE,
            ConstantNameDetector.ISSUE,
            BuildGradleVersionDetector.ISSUE,
            ViewHolderItemNameDetector.ISSUE,
            NotOperatorArgumentDetector.ISSUE);
}
 
开发者ID:ljfxyj2008,项目名称:CustomLintDemo,代码行数:21,代码来源:MyIssueRegistry.java

示例3: getIssuesForScope

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
/**
 * Returns all available issues of a given scope (regardless of whether
 * they are actually enabled for a given configuration etc)
 *
 * @param scope the applicable scope set
 * @return a list of issues
 */
@NonNull
protected List<Issue> getIssuesForScope(@NonNull EnumSet<Scope> scope) {
    List<Issue> list = sScopeIssues.get(scope);
    if (list == null) {
        List<Issue> issues = getIssues();
        if (scope.equals(Scope.ALL)) {
            list = issues;
        } else {
            list = new ArrayList<Issue>(getIssueCapacity(scope));
            for (Issue issue : issues) {
                // Determine if the scope matches
                if (issue.getImplementation().isAdequate(scope)) {
                    list.add(issue);
                }
            }
        }
        sScopeIssues.put(scope, list);
    }

    return list;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:IssueRegistry.java

示例4: matches

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
private static boolean matches(@Nullable Issue issue, @NonNull String id) {
    if (id.equalsIgnoreCase(SUPPRESS_ALL)) {
        return true;
    }

    if (issue != null) {
        String issueId = issue.getId();
        if (id.equalsIgnoreCase(issueId)) {
            return true;
        }
        if (id.startsWith(STUDIO_ID_PREFIX)
            && id.regionMatches(true, STUDIO_ID_PREFIX.length(), issueId, 0, issueId.length())
            && id.substring(STUDIO_ID_PREFIX.length()).equalsIgnoreCase(issueId)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:LintDriver.java

示例5: getSeverity

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
@Override
@NonNull
public Severity getSeverity(@NonNull Issue issue) {
    ensureInitialized();

    Severity severity = mSeverity.get(issue.getId());
    if (severity == null) {
        severity = mSeverity.get(VALUE_ALL);
    }

    if (severity != null) {
        return severity;
    }

    if (mParent != null) {
        return mParent.getSeverity(issue);
    }

    return getDefaultSeverity(issue);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DefaultConfiguration.java

示例6: ignore

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
/**
 * Marks the given issue and file combination as being ignored.
 *
 * @param issue the issue to be ignored in the given file
 * @param file the file to ignore the issue in
 */
public void ignore(@NonNull Issue issue, @NonNull File file) {
    ensureInitialized();

    String path = mProject != null ? mProject.getRelativePath(file) : file.getPath();

    List<String> paths = mSuppressed.get(issue.getId());
    if (paths == null) {
        paths = new ArrayList<String>();
        mSuppressed.put(issue.getId(), paths);
    }
    paths.add(path);

    // Keep paths sorted alphabetically; makes XML output stable
    Collections.sort(paths);

    if (!mBulkEditing) {
        writeConfig();
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DefaultConfiguration.java

示例7: checkElement

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
/** Checks whether the given element is the given tag, and if so, whether it satisfied
 * the minimum version that the given tag is supported in */
private void checkElement(@NonNull XmlContext context, @NonNull Element element,
        @NonNull String tag, int api, @NonNull Issue issue) {
    if (tag.equals(element.getTagName())) {
        int minSdk = getMinSdk(context);
        if (api > minSdk && api > context.getFolderVersion()
                && api > getLocalMinSdk(element)) {
            Location location = context.getLocation(element);
            String message;
            if (issue == UNSUPPORTED) {
                message = String.format(
                        "`<%1$s>` requires API level %2$d (current min is %3$d)", tag, api,
                        minSdk);
            } else {
                assert issue == UNUSED : issue;
                message = String.format(
                        "`<%1$s>` is only used in API level %2$d and higher "
                                + "(current min is %3$d)", tag, api, minSdk);
            }
            context.report(issue, element, location, message);
        }
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ApiDetector.java

示例8: report

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
private void report(@NonNull Context context, @NonNull Object cookie, @NonNull Issue issue,
        @NonNull String message) {
    if (context.isEnabled(issue)) {
        // Suppressed?
        // Temporarily unconditionally checking for suppress comments in Gradle files
        // since Studio insists on an AndroidLint id prefix
        boolean checkComments = /*context.getClient().checkForSuppressComments()
                &&*/ context.containsCommentSuppress();
        if (checkComments) {
            int startOffset = getStartOffset(context, cookie);
            if (startOffset >= 0 && context.isSuppressedWithComment(startOffset, issue)) {
                return;
            }
        }

        context.report(issue, createLocation(context, cookie), message);
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GradleDetector.java

示例9: reportMap

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
private void reportMap(Context context, Issue issue, Map<String, Location> map) {
    if (map != null) {
        for (Map.Entry<String, Location> entry : map.entrySet()) {
            Location location = entry.getValue();
            String name = entry.getKey();
            String message = mDescriptions.get(name);

            if (location == null) {
                location = Location.create(context.getProject().getDir());
            }

            // We were prepending locations, but we want to prefer the base folders
            location = Location.reverse(location);

            context.report(issue, location, message);
        }
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TranslationDetector.java

示例10: getSeverity

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
@NonNull
@Override
public Severity getSeverity(@NonNull Issue issue) {
    Severity severity = computeSeverity(issue);

    if (mFatalOnly && severity != Severity.FATAL) {
        return Severity.IGNORE;
    }

    if (mFlags.isWarningsAsErrors() && severity == Severity.WARNING) {
        severity = Severity.ERROR;
    }

    if (mFlags.isIgnoreWarnings() && severity == Severity.WARNING) {
        severity = Severity.IGNORE;
    }

    return severity;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:LintCliClient.java

示例11: getIssuesFromInspections

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
@NotNull
static List<Issue> getIssuesFromInspections(@NotNull Project project, @Nullable PsiElement context) {
  final List<Issue> result = new ArrayList<Issue>();
  final IssueRegistry fullRegistry = new IntellijLintIssueRegistry();

  for (Issue issue : fullRegistry.getIssues()) {
    final String inspectionShortName = AndroidLintInspectionBase.getInspectionShortNameByIssue(project, issue);
    if (inspectionShortName == null) {
      continue;
    }

    final HighlightDisplayKey key = HighlightDisplayKey.find(inspectionShortName);
    if (key == null) {
      continue;
    }

    final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
    final boolean enabled = context != null ? profile.isToolEnabled(key, context) : profile.isToolEnabled(key);

    if (!enabled) {
      continue;
    }
    result.add(issue);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AndroidLintExternalAnnotator.java

示例12: getIssues

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
@Override
public List<Issue> getIssues() {
    return Arrays.asList(
            WithIdDetector.ISSUE,
            WithTextDetector.ISSUE,
            OnViewDetector.ISSUE,
            WithViewDetector.ISSUE,
            AllOfIsDisplayedDetector.ISSUE
    );
}
 
开发者ID:vincetreur,项目名称:Ristretto,代码行数:11,代码来源:RistrettoLintIssueRegistry.java

示例13: getIssues

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
@Override public List<Issue> getIssues() {
    return Arrays.asList(
            QMUIFWordDetector.ISSUE_F_WORD,
            QMUIJavaVectorDrawableDetector.ISSUE_JAVA_VECTOR_DRAWABLE,
            QMUIXmlVectorDrawableDetector.ISSUE_XML_VECTOR_DRAWABLE,
            QMUIImageSizeDetector.ISSUE_IMAGE_SIZE,
            QMUIImageScaleDetector.ISSUE_IMAGE_SCALE
    );
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:10,代码来源:QMUIIssueRegistry.java

示例14: getIssues

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
@Override
public List<Issue> getIssues() {
    return Arrays.asList(
            SharingGroupClassificationDetector.SEPARATE_BY_ISOLATED_GROUP_ISSUE,
            SharingGroupClassificationDetector.SEPARATE_BY_GROUP_ISSUE,
            SharingGroupClassificationDetector.SEPARATE_BY_SINGLE_ISSUE,
            SharingGroupClassificationDetector.TRY_SEPARATE_BY_ROLE_ISSUE);
}
 
开发者ID:cch-robo,项目名称:Android_Lint_SRP_Practice_Example,代码行数:9,代码来源:SrpPracticeIssueRegistry.java

示例15: getIssues

import com.android.tools.lint.detector.api.Issue; //导入依赖的package包/类
@Override
protected List<Issue> getIssues() {
    return Arrays.asList(
            SharingGroupClassificationDetector.SEPARATE_BY_ISOLATED_GROUP_ISSUE,
            SharingGroupClassificationDetector.SEPARATE_BY_GROUP_ISSUE,
            SharingGroupClassificationDetector.SEPARATE_BY_SINGLE_ISSUE,
            SharingGroupClassificationDetector.TRY_SEPARATE_BY_ROLE_ISSUE);
}
 
开发者ID:cch-robo,项目名称:Android_Lint_SRP_Practice_Example,代码行数:9,代码来源:SharingGroupClassificationDetectorTest.java


注:本文中的com.android.tools.lint.detector.api.Issue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。