Changes between Version 9 and Version 10 of Documentation/T3Q/Quality-Checks/Code-Style
- Timestamp:
- 12/21/18 03:46:07 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Documentation/T3Q/Quality-Checks/Code-Style
v9 v10 96 96 ==== There Must Be No Over-specific Runs On Clauses ==== 97 97 * '''Symbolic Name in XML Configuration''': checkNoOverSpecificRunsOnClauses 98 * '''Dependant Tags in XML Configuration''': recursionInCheckNoOverSpecificRunsOnClauses, extendsInCheckNoOverSpecificRunsOnClauses (since v2.0.0b26)98 * '''Dependant Tags in XML Configuration''': recursionInCheckNoOverSpecificRunsOnClauses, aliasInCheckNoOverSpecificRunsOnClauses (since v2.0.0b27) 99 99 100 100 This check will make sure no over-specific '''runs on''' clauses are used. An over-specific runs on clause is when none of the component element definitions (variables, timers, constants, and ports) of the component used in the runs on clause are referenced within the body of the function or alststep with the runs on clause. If at least one of the component element definitions is referenced within the body of the function or altstep, then no problem is reported. If the '''recursionInCheckNoOverSpecificRunsOnClauses''' setting is enabled (which it is by default), also the functions and altsteps referenced within the body of the current construct will be inspected. This is due to the fact that often wrapper functions are used that do not make direct use of the component element definitions themselves. … … 106 106 [[Include(source:trunk/t3q-examples/checkNoOverSpecificRunsOn/checkNoOverSpecificRunsOn.ttcn3, text/x-rst)]] 107 107 108 As of v2.0.0b2 6 an additional setting '''extendsInCheckNoOverSpecificRunsOnClauses''' is provided to enable the consideration of definitions recursively inherited from extended components as well (disabled by default). If this setting is enabled, a function or an altstep specified to run on a given component will only raise a warning if none of the definitions within the component itself ''as well as'' all the components that this component extends (andthe components extended by those components recursively) are used within the function or altstep. For example:108 As of v2.0.0b27 an additional setting '''aliasInCheckNoOverSpecificRunsOnClauses''' is provided to enable the special treatment of component "alias" type definitions (component type definitions without any owned definitions that extend another component type and inherit its definitions, enabled by default). If this setting is enabled, a function or an altstep specified to run on a given component will only raise a warning if none of the definitions of the component(s) that this component extends directly (not considering the components extended by those components recursively) are used within the function or altstep. For example: 109 109 110 110 {{{ … … 114 114 } 115 115 116 117 //alias / extension 118 type component directAlias extends componentWithDefinition { 116 //extension with own definitions 117 type component directExtension extends componentWithDefinition { 118 var integer directExtensionVariable; 119 } 120 121 //multi alias / extension ("pure", without own definitions) 122 type component indirectAlias extends directExtension { 119 123 120 124 } 121 125 122 //multi alias / extension123 type component multiAlias extends directAlias{126 //multi alias / extension ("pure", without own definitions) 127 type component pureAlias extends componentWithDefinition { 124 128 125 129 } 126 130 127 131 //always good - base component 128 132 function someFunctionOnBaseComponent () … … 131 135 } 132 136 133 134 //good - via direct alias (with extendsInCheckNoOverSpecificRunsOnClauses) 135 //bad - no definition from directAlias used (without extendsInCheckNoOverSpecificRunsOnClauses) 137 //bad - no definition from directExtension used 136 138 function someFunctionOnDirectAlias () 137 runs on directAlias { 138 definedTimer.start ( 10.0 ); 139 } 140 141 142 //good - via multi alias (with extendsInCheckNoOverSpecificRunsOnClauses) 143 //bad - no definition from multiAlias used (without extendsInCheckNoOverSpecificRunsOnClauses) 139 runs on directExtension { 140 definedTimer.start ( 10.0 ); 141 } 142 143 144 //bad - no definition from aliased directExtension used 144 145 function someFunctionOnMultiAlias () 145 runs on multiAlias { 146 definedTimer.start ( 10.0 ); 147 } 146 runs on indirectAlias { 147 definedTimer.start ( 10.0 ); 148 } 149 150 //good - definition from aliased directExtension is used (directAliasVariable) 151 function someFunctionOnMultiAliasWithReferenceToVariable () 152 runs on indirectAlias { 153 definedTimer.start ( 10.0 ); 154 directExtensionVariable := 1; 155 } 156 157 //good - definition from aliased componentWithDefinition is used (definedTimer) 158 function someFunctionOnPureAlias () 159 runs on pureAlias { 160 definedTimer.start ( 10.0 ); 161 } 162 148 163 }}} 149 164