[litho] print name of component with missing prop

Reviewed By: jeremydubreil

Differential Revision: D6974430

fbshipit-source-id: 07d2247
master
Sam Blackshear 7 years ago committed by Facebook Github Bot
parent 5ebc6562ee
commit f191819642

@ -122,9 +122,10 @@ module RequiredProps = struct
[]
let report_missing_required_prop summary prop_string loc =
let report_missing_required_prop summary prop_string parent_typename loc =
let message =
F.asprintf "@Prop %s is required, but not set before the call to build()" prop_string
F.asprintf "@Prop %s is required for component %s, but is not set before the call to build()"
prop_string (Typ.Name.name parent_typename)
in
let exn =
Exceptions.Checkers (IssueType.missing_required_prop, Localise.verbatim_desc message)
@ -178,7 +179,8 @@ module RequiredProps = struct
List.iter
~f:(fun required_prop ->
if not (has_prop prop_set required_prop) then
report_missing_required_prop summary required_prop (Specs.get_loc summary) )
report_missing_required_prop summary required_prop parent_typename
(Specs.get_loc summary) )
required_props
| _ ->
() )

@ -1,12 +1,12 @@
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.FP_setRequiredOnBothBranchesOk(boolean), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required, but not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.buildWithout1Bad(), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required, but not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.buildWithout3Bad(), 0, MISSING_REQUIRED_PROP, [@Prop prop3 is required, but not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.callBuildSuffixWithoutRequiredBad(), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required, but not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.setProp3InCalleeButForgetProp1Bad(), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required, but not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.setRequiredOnOneBranchBad(boolean), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required, but not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, Object RequiredProps.generalTypeForgot3Bad(), 0, MISSING_REQUIRED_PROP, [@Prop prop3 is required, but not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, void RequiredProps.buildPropResMissingBad(), 0, MISSING_REQUIRED_PROP, [@Prop prop is required, but not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, void RequiredProps.buildWithColumnChildBad(), 0, MISSING_REQUIRED_PROP, [@Prop prop3 is required, but not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.FP_setRequiredOnBothBranchesOk(boolean), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.buildWithout1Bad(), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.buildWithout3Bad(), 0, MISSING_REQUIRED_PROP, [@Prop prop3 is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.callBuildSuffixWithoutRequiredBad(), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.setProp3InCalleeButForgetProp1Bad(), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, MyComponent RequiredProps.setRequiredOnOneBranchBad(boolean), 0, MISSING_REQUIRED_PROP, [@Prop prop1 is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, Object RequiredProps.generalTypeForgot3Bad(), 0, MISSING_REQUIRED_PROP, [@Prop prop3 is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, void RequiredProps.buildPropResMissingBad(), 0, MISSING_REQUIRED_PROP, [@Prop prop is required for component codetoanalyze.java.litho.ResPropComponent, but is not set before the call to build()]
codetoanalyze/java/litho/RequiredProps.java, void RequiredProps.buildWithColumnChildBad(), 0, MISSING_REQUIRED_PROP, [@Prop prop3 is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build()]
codetoanalyze/java/litho/ShouldUpdate.java, void LithoTest.onCreateLayout(), 0, GRAPHQL_FIELD_ACCESS, [&story.getActors().get(...)]
codetoanalyze/java/litho/ShouldUpdate.java, void LithoTest.onCreateLayout(), 0, GRAPHQL_FIELD_ACCESS, [&story.getActors().get(...).toString()]
codetoanalyze/java/litho/ShouldUpdate.java, void LithoTest.onCreateLayout(), 0, GRAPHQL_FIELD_ACCESS, [&story.getActors().size()]

Loading…
Cancel
Save