Reviewed By: dulmarod Differential Revision: D5155036 fbshipit-source-id: 35ac690master
parent
f9c146ced1
commit
2e8e5733f6
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
TESTS_DIR = ../../..
|
||||||
|
|
||||||
|
ANALYZER = linters
|
||||||
|
CLANG_OPTIONS = -c
|
||||||
|
INFER_OPTIONS = --linters-def-folder checks --project-root $(TESTS_DIR) --no-failures-allowed
|
||||||
|
INFERPRINT_OPTIONS = --issues-tests
|
||||||
|
|
||||||
|
SOURCES = file.m
|
||||||
|
|
||||||
|
include $(TESTS_DIR)/clang.make
|
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This source code is licensed under the BSD style license found in the
|
||||||
|
// LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
// of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
DEFINE-CHECKER FORBIDDEN_NAME_EXAMPLE = {
|
||||||
|
SET report_when = WHEN is_class("ForbiddenClassName") HOLDS-IN-NODE ObjCInterfaceDecl;
|
||||||
|
SET message = "ForbiddenClassName is forbidden, please use another name";
|
||||||
|
};
|
@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
not_an_al_file.al.txt is not an AL file.
|
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This source code is licensed under the BSD style license found in the
|
||||||
|
// LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
// of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
DEFINE-CHECKER SUBCLASSING_TEST_EXAMPLE = {
|
||||||
|
SET report_when = is_class("A") HOLDS-IN-SOME-SUPERCLASS-OF ObjCInterfaceDecl;
|
||||||
|
SET message = "This is subclassing A. Class A should not be subclassed.";
|
||||||
|
};
|
@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
unrelated_file.al.txt is not an AL file.
|
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Test the functionality of the --linters-def-folder flag
|
||||||
|
|
||||||
|
#import <Foundation/NSObject.h>
|
||||||
|
|
||||||
|
@interface A : NSObject
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation A
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface B : A
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation B
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface ForbiddenClassName : NSObject
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation ForbiddenClassName
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface C : NSObject
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation C
|
||||||
|
@end
|
@ -0,0 +1,2 @@
|
|||||||
|
codetoanalyze/objc/linters-def-folder/file.m, Linters_dummy_method, 20, SUBCLASSING_TEST_EXAMPLE, []
|
||||||
|
codetoanalyze/objc/linters-def-folder/file.m, Linters_dummy_method, 26, FORBIDDEN_NAME_EXAMPLE, []
|
Loading…
Reference in new issue