本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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
);
}
示例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
);
}
示例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);
}
示例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