[componentkit] Gate analytics behind flag

Reviewed By: dulmarod

Differential Revision: D4217464

fbshipit-source-id: e11d172
master
Ryan Rhee 8 years ago committed by Facebook Github Bot
parent f0bb23bc35
commit 661de290e7

@ -701,6 +701,13 @@ and cluster =
CLOpt.mk_path_opt ~deprecated:["cluster"] ~long:"cluster"
~meta:"file" "Specify a .cluster file to be analyzed"
and compute_analytics =
CLOpt.mk_bool ~long:"compute-analytics"
~default:false
~exes:CLOpt.[Toplevel;Clang]
"Emit analytics as info-level issues, like component kit line count and \
component kit file cyclomatic complexity"
(** Continue the capture for reactive mode:
If a procedure was changed beforehand, keep the changed marking. *)
and continue =
@ -1417,6 +1424,7 @@ and checkers_repeated_calls = !checkers_repeated_calls
and clang_biniou_file = !clang_biniou_file
and clang_include_to_override = !clang_include_to_override
and cluster_cmdline = !cluster
and compute_analytics = !compute_analytics
and continue_capture = !continue
and copy_propagation = !copy_propagation
and crashcontext = !crashcontext

@ -163,6 +163,7 @@ val clang_frontend_do_capture : bool
val clang_frontend_do_lint : bool
val clang_include_to_override : string option
val cluster_cmdline : string option
val compute_analytics : bool
val continue_capture : bool
val copy_propagation : bool
val crashcontext : bool

@ -62,7 +62,8 @@ EXPECTED_OUTPUTS_DIR = os.path.join(SCRIPT_DIR, 'expected_outputs')
ALL_TESTS = [
'cmake',
'componentkit',
'componentkit_analytics',
'componentkit_imports',
'delete',
'fail',
'gradle',
@ -471,8 +472,19 @@ class BuildIntegrationTest(unittest.TestCase):
'infer_args': reactive_args},
{'compile': ['analyze']}])
def test_clang_component_kit_analytics(self):
test('componentkit_analytics',
'component quality analyzer emits analytics info when flag is '
'enabled',
os.path.join(CODETOANALYZE_DIR, 'componentkit'),
[{'compile': ['clang', '-x', 'objective-c++', '-std=c++11', '-c',
'-fblocks', 'TestComponentKitAnalytics.mm'],
'infer_args': ['--cxx', '--no-filtering', '-a', 'linters',
'--compute-analytics']}])
def test_clang_component_kit_imports(self):
test('componentkit', 'component quality analyzer skips imports',
test('componentkit_imports',
'component quality analyzer skips imports',
os.path.join(CODETOANALYZE_DIR, 'componentkit'),
[{'compile': ['clang', '-x', 'objective-c++', '-std=c++11', '-c',
'-fblocks', 'TestIgnoreImports.mm'],

@ -0,0 +1,15 @@
/*
* Copyright (c) 2016 - 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.
*/
#include "../../../codetoanalyze/objcpp/linters/componentkit/FakeComponentKitHeader.h"
@interface SomeClass : CKCompositeComponent
@end
@implementation SomeClass
@end
Loading…
Cancel
Save