Faux pas的shell脚本
fauxpas
Faux Pas检查您的iOS或Mac应用程序的Xcode项目,并警告可能的错误,以及可维护性和样式问题。
clang静态分析器是分析代码.
faux pas是分析你的整个xcode项目。
fauxpas命令的使用
生成xml格式的log
//fauxpas check projectName.xcodeproj是指检查这个工作区间
//--workspace projectName.xcworkspace如果使用了pod就要指定xcworkspace
// -b Debug指定debug的编译方式,默认是release
//--scheme projectName指定scheme
//-o json指定输出的内容的格式
//--excludedRules StringsdictWithoutStrings是在默认的rule的基础上除掉一个
fauxpas check projectName.xcodeproj --workspace projectName.xcworkspace -b Debug --scheme projectName -o json --excludedRules StringsdictWithoutStrings | ./fauxpas_convert.py checkstyle_xml > log
//其他的命令使用“fauxpas help”查询帮助
生成json文件
//包含所有规则的检测
fauxpas check projectName.xcodeproj --workspace projectName.xcworkspace -b Debug --scheme projectName -o json -r UndetachedDelegate,MallocWithoutSizeof,AssertionSideEffects,LoadMethodWithoutAutoreleasePool,InitializeSuperInvocation,HardcodedSelfClass,MacroBasedIncludeGuard,RetainingImmutableProperty,CompleteNotificationCenterDetachment,OldVerboseObjCSyntax,StrongDelegate,ConstructorReturnType,SetterInvocationInInitOrDealloc,ArgumentModification,FastEnumElementOutside,UnusedErrorValue,CopyingMutableProperty,InstanceMethodWritesToStaticVariable,AssociatedObjectOnValueType,PrefixHeaderIncludeSuggestion,TerminatingApp,PrivateCategory,IBOutletsInPublicInterface,InitializeMethodCategoryOverride,ImplicitAtomicProperty,AssigningDelegate,Swizzling,DiscardedOpaqueNotificationObserver,ErrorConditionCheck,RedundantInclude,NSLogUsed,UnprefixedCategoryMethod,UnidiomaticAccessorNaming,ViewControllerInitWithNibName,RetinaImagesResolution,SuspiciousResources,UnknownResourceCodeReference,UnusedResource,XIBUnknownClassReference,XIBRuntimeAttributeMismatch,MissingDeviceTypeResource,MissingImageResolutionVariant,WeakReferenceToTopLevelXIBObject,UnknownResourceXIBReference,GlobalAndLocalizedResource,UnknownResourceModifier,SuspiciousMissingResources,DuplicateResource,BuildSettingsSetInGUI,CompilerWarnings,MissingAPIUsageDescription,ViewLayoutInXIB,BasicProjectSettings,ImplicitBundleId,ReleaseBuildCompilerArgs,XcconfigOverwrites,BuildSettingSelfReference,BuildSettingPlacement,AbsPathInBuildSetting,FileRefWithAbsPath,ReleaseBuildConfig,DylibInstallName,InvalidStringsFile,UnusedTranslation,StringsdictWithoutStrings,HardcodedUIString,MissingTranslation,DuplicateTranslation,TranslationPunctuation,TranslationFormatMismatch,UncommentedLocalizedString,UIKitKVO,APIAvailability,RestrictedDirectMethodCall,RestrictedMethodOverride,IsEqualAndHash,LiteralStringKeyPath,FixedFormatDateFormatter,SuspiciousDateTimeFormat,BlockAPIRetainCycle,MissingNotificationCenterDetachment,StringsFileEncoding,RecommendedVCSIgnores,FileRefOutsideVCS,FileRefIgnoredInVCS,NullCoalescingOp,StrongInsteadOfRetain,OrderedComparisonOpDirection,ThrowingObjCException,NewInitializer,NonTypedefBlockDeclaration,Spelling,SourceFileHeaderComment,UnprefixedClass,DotSyntax,IdentifierNaming,MacroLiteral,UnnecessaryNullCheck,UnusedMethod,ReservedIdentifierNaming,CyclomaticComplexity,DefaultInExhaustiveSwitch,MallocCast,ReservedPrefix,UsedVariableMarkedUnused,UnsupportedWeakReference,ThreadUnsafeInstanceCaching,UnnecessaryNibMethod,OrderedPointerToZeroComparison,ZeroAssignmentToPointer,CategoryMethodConflict > log.json
输入json以xml的形式展示
下载fauxpas-converter-master.zip,xmlbuilder-1.0.tar.gz,get-pip.py 再执行下面两句命令
python -m pip install docopt
sudo python -m pip install xmlbuilder
注意
将fauxpas-converter-master.zip中的fauxpas_convert.py移动到projectName文件夹中,再运行命令
fauxpas -o json check MyProject.xcodeproj \
| ./fauxpas_convert.py checkstyle_xml
一切顺利的话,就会输出名为checkstyle_xml的文件。
输入json以网站的形式展示
将fauxpas-web-presenter-master直接clone下来就好。
解析fauxpas生成的json的网站