├── .gitignore ├── .pubignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── lib ├── glory_convention_lint.dart ├── helper │ ├── documentation_constants.dart │ ├── lint_type_constant.dart │ └── string_extention.dart └── rules │ ├── correct_base_response_import_convention.dart │ ├── correct_one_variable_for_lang_convention.dart │ ├── enum_file_name_convention.dart │ ├── enum_name_convention.dart │ ├── network_model_annotation_convention.dart │ ├── network_model_class_name_convention.dart │ ├── network_model_file_name_convention.dart │ ├── network_model_json_implementation_convention.dart │ ├── network_request_class_name_convention.dart │ ├── network_request_file_name_convention.dart │ ├── network_response_class_name_convention.dart │ ├── network_response_file_name_convention.dart │ ├── network_service_annotation_convention.dart │ ├── network_service_class_name_convention.dart │ ├── network_service_file_name_convention.dart │ ├── prefer_nullable_model.dart │ ├── prefer_single_class_per_file.dart │ ├── prefer_single_enum_per_file.dart │ ├── prefer_static_const_lang_variable.dart │ └── prefer_upper_camel_case.dart ├── playground ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── rgb_lint_playground │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── data │ │ ├── enums │ │ │ ├── correct_name_enum.dart │ │ │ └── incorrect_name_enum.dart │ │ ├── languages │ │ │ └── id │ │ │ │ └── button_lang.dart │ │ └── network │ │ │ ├── enums │ │ │ ├── correct_enum_name_network_enum.dart │ │ │ └── incorrect_enum_name_network_enum.dart │ │ │ ├── model │ │ │ └── incorrect_model_name_network_enum.dart │ │ │ └── service │ │ │ └── incorrect_service_rule_service.dart │ └── main.dart ├── pubspec.yaml └── test │ └── widget_test.dart ├── pubspec.yaml ├── resource ├── incorrect_service_rule.png └── incorrect_service_rule_problems.png └── test └── glory_convention_lint_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub. 2 | .dart_tool/ 3 | .packages 4 | 5 | # Conventional directory for build outputs. 6 | build/ 7 | 8 | # Omit committing pubspec.lock for library packages; see 9 | # https://dart.dev/guides/libraries/private-files#pubspeclock. 10 | pubspec.lock 11 | /.idea/ 12 | -------------------------------------------------------------------------------- /.pubignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub. 2 | .dart_tool/ 3 | .packages 4 | 5 | # Conventional directory for build outputs. 6 | build/ 7 | 8 | # Omit committing pubspec.lock for library packages; see 9 | # https://dart.dev/guides/libraries/private-files#pubspeclock. 10 | pubspec.lock 11 | /.idea/ 12 | 13 | playground/ -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Rolling Glory 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![Pub Version](https://img.shields.io/pub/v/glory_convention_lint?logo=dart&logoColor=white)](https://pub.dev/packages/glory_convention_lint/) 3 | [![Dart SDK Version](https://badgen.net/pub/sdk-version/glory_convention_lint)](https://pub.dev/packages/glory_convention_lint/) 4 | [![License](https://img.shields.io/github/license/rollingglory/GloryConventionLint-flutter)](https://github.com/rollingglory/GloryConventionLint-flutter/blob/master/LICENSE) 5 | 6 |   7 |   8 | 9 | 10 | **RollingGlory** is Company or Creative Digital Media studio based in Bandung, Indonesia. 11 | 12 |   13 |   14 | # GloryConventionLint-Flutter 15 | GloryConventionLint is code judgment for Convention Lint Flutter support IDE Android Studio/Visual Studio Code. 16 |   17 | 18 | 19 | 20 | ## Setup 21 | - add glory_convention_lint into `package.yaml` 22 | ~~~ bash 23 | $ flutter pub add --dev glory_convention_lint 24 | ~~~ 25 | 26 | ~~~yaml 27 | dev_dependencies: 28 | glory_convention_lint: ^1.0.0 29 | custom_lint: ^0.2.5 30 | ~~~ 31 | 32 | - add plugin analyzer into `analysis_options.yaml` 33 | 34 | 35 | ~~~yaml 36 | analyzer: 37 | plugins: 38 | - custom_lint 39 | ~~~ 40 | 41 | 42 | ## Conventions 43 | 44 | #### Model Convention 45 | * [Model class name convention](#model-class-name-convention) 46 | * [Model file name convention](#model-file-name-convention) 47 | * [Model annotation convention](#model-annotation-convention) 48 | * [Prefer nullable for models convention](#prefer-nullable-for-models-convention) 49 | 50 | #### Service Convention 51 | * [Service class name convention](#service-class-name-convention) 52 | * [Service file name convention](#service-file-name-convention) 53 | * [Service annotation convention](#service-annotation-convention) 54 | 55 | #### Enum Convention 56 | * [Enum name convention](#enum-name-convention) 57 | * [Enum file name convention](#enum-file-name-convention) 58 | 59 | #### Request Convention 60 | * [Request class name convention](#request-class-name-convention) 61 | * [Request file name convention](#request-file-name-convention) 62 | 63 | #### Response Convention 64 | * [Response class name convention](#response-class-name-convention) 65 | * [Response file name convention](#response-file-name-convention) 66 | 67 | #### Other Convention 68 | * [Naming Convention](#naming-convention) 69 | * [Prefer single class per file convention](#prefer-single-class-per-file-convention) 70 | * [Prefer static const lang variable convention](#prefer-static-const-lang-variable-convention) 71 | * [Base response import convention](#base-response-import-convention) 72 | * [One variable for lang convention](#prefer-one-variable-for-language-convention) 73 | 74 |   75 | ## Examples 76 | 77 | #### Model Convention Example 78 | * [Model class name convention example](#model-class-name-convention-example) 79 | * [Model file name convention example](#model-file-name-convention-example) 80 | * [Model annotation convention example](#model-annotation-convention-example) 81 | * [Prefer nullable for models convention example](#prefer-nullable-for-models-convention-example) 82 | 83 | #### Service Convention Example 84 | * [Service class name convention example](#service-class-name-convention-example) 85 | * [Service file name convention example](#service-file-name-convention-example) 86 | * [Service annotation convention example](#service-annotation-convention-example) 87 | 88 | #### Enum Convention Example 89 | * [Enum name convention example](#enum-name-convention-example) 90 | * [Enum file name convention example](#enum-file-name-convention-example) 91 | 92 |   93 | --- 94 | # Conventions 95 | ## Model Convention 96 | ### Model class name convention 97 | Ensure to add Model word at the end of class name in models file 98 | ~~~dart 99 | //DO 100 | class ProductModel {} 101 | //DON'T 102 | class Model {} 103 | ~~~ 104 | ### Model file name convention 105 | The file name for models must end with _model.dart 106 | ~~~dart 107 | //DO 108 | product_model.dart 109 | //DON'T 110 | product.dart 111 | productmodel.dart 112 | ~~~ 113 | Model file must always be put inside of model directory. 114 | ~~~ 115 | |- data 116 | |- network 117 | |- models 118 | ~~~ 119 | 120 | ### Model annotation convention 121 | Add @JsonSerializable() from Retrofit to above your class model name 122 | ~~~dart 123 | //DO 124 | @JsonSerializable() 125 | class ProductModel { 126 | int? id; 127 | } 128 | //DON'T 129 | class ProductModel { 130 | int? id; 131 | } 132 | @JsonSerializable() 133 | ~~~ 134 | ### Prefer nullable for models convention 135 | Fields of Model class is preferable to have nullable field. example : String? instead of String 136 | ~~~dart 137 | //DO 138 | class Product { 139 | String? name; 140 | Product({this.name}); 141 | } 142 | //DON'T 143 | class Product { 144 | String name; 145 | Product({this.name}); 146 | } 147 | ~~~ 148 | 149 | ## Service Convention 150 | ### Service class name convention 151 | Ensure to add Services word at the end of class name in models file 152 | ~~~dart 153 | //DO 154 | class GiftServices{} 155 | class ProductServices{} 156 | //DON'T 157 | class Gift{} 158 | class ProductService{} // singular instead of plural 159 | ~~~ 160 | ### Service file name convention 161 | The file name for services must end with service.dart 162 | ~~~dart 163 | //DO 164 | gift_services.dart 165 | product_services.dart 166 | //DON'T 167 | product_service.dart //singular instead of plural 168 | ProductRequest.dart 169 | ~~~ 170 | Service file must always be put inside of services directory. 171 | ~~~ 172 | |- data 173 | |- network 174 | |- services 175 | ~~~ 176 | 177 | ### Service annotation convention 178 | Add @RestApi() from Retrofit to above your class service name 179 | ~~~dart 180 | //DO 181 | @RestApi() //RestApi Annotation is added 182 | abstract class ProductServices {} 183 | //DON'T 184 | //Forget to add RestApi Annotation 185 | abstract class ProductServices {} 186 | ~~~ 187 | 188 | ## Enum Convention 189 | #### Enum class name convention 190 | Ensure to add Enum word at the end of enum class name in the file. 191 | ~~~dart 192 | //DO 193 | enum AvatarEnum {} 194 | //DON'T 195 | enum EnumAvatar {} 196 | ~~~ 197 | 198 | ### Enum file name convention 199 | Ensure to add _enum.dart prefix at the end of file name. 200 | ~~~dart 201 | //DO 202 | gift_enum.dart 203 | product_enum.dart 204 | //DON'T 205 | ProductEnum.dart 206 | ~~~ 207 | Enum file must always be put inside of enum directory or network enum directory. 208 | ~~~ 209 | //Network enum directory 210 | |- data 211 | |- network 212 | |- enums 213 | 214 | //Enum directory 215 | |- data 216 | |- enums 217 | ~~~ 218 | 219 | ## Request Convention 220 | ### Request class name convention 221 | Request class always end with "Request", and must use *PascalCase*. 222 | ~~~dart 223 | //DO 224 | class GiftRequest{} 225 | class ProductRequest{} 226 | 227 | //DON'T 228 | class Gift{} 229 | class product_request{} 230 | ~~~ 231 | 232 | ### Request file name convention 233 | Request file must always end with "_request" and should always use *snake_case* for file naming. 234 | ~~~ 235 | //DO 236 | product_request.dart 237 | 238 | //DON'T 239 | ProductRequest.dart 240 | ~~~ 241 | Request file must always be put inside of request directory. 242 | ~~~ 243 | |- data 244 | |- network 245 | |- request 246 | ~~~ 247 |   248 | ## Response Convention 249 | ### Response class name convention 250 | Response class always end with "Response", and must use *PascalCase*. 251 | ~~~dart 252 | //DO 253 | class GiftResponse{} 254 | class ProductResponse{} 255 | 256 | //DON'T 257 | class Gift{} 258 | class product_response{} 259 | ~~~ 260 | 261 | ### Response file name convention 262 | Response file must always end with "_response" and should always use *snake_case* for file naming. 263 | ~~~ 264 | //DO 265 | product_response.dart 266 | 267 | //DON'T 268 | ProductResponse.dart 269 | ~~~ 270 | Response file must always be put inside of response directory. 271 | ~~~ 272 | |- data 273 | |- network 274 | |- response 275 | ~~~ 276 | 277 |   278 | ## Other Convention 279 | ### Naming Convention 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 |
 
PascalCaseCamelCasePluralSnakeCaseExamples
Classclass ModelResponse{}
Service Classclass ModelServices{}
Constant Classclass NetworkConstants{}
Extensionextension StringExtensions on String
Fieldint id;
Variableint variable;
Local variableint _variable;
ParameterString param
Methodvoid methodName(){}
Local Methodvoid _methodName(){}
Enum Typeenum Status{}
382 | 383 | ### Prefer single class per file convention 384 | Avoid Declaring multiple classes in one file. It is best practice to declare one class in one file instead of multiple of class in one files, to reduce 385 | confusion. 386 | ~~~dart 387 | //DO 388 | -- test.dart -- 389 | class One = {}; 390 | 391 | //DON'T 392 | -- test.dart -- 393 | class One = {}; 394 | class Two = {}; 395 | ~~~ 396 | 397 | ### Prefer static const lang variable convention 398 | Declare variable as static const. 399 | ~~~dart 400 | //DO 401 | class One { 402 | static const variableOne = "Value" 403 | } 404 | 405 | //DON'T 406 | class One { 407 | String variableOne = "Value"; 408 | } 409 | ~~~ 410 | 411 | ### Base response import convention 412 | Both BaseResponse and BaseListResponse must be implemented and imported from rollingglory_codebase 413 | When an application communicates to the backend via API calls, we usually receive two type of responses. single object and multi objects. 414 | both types need to be implemented in service file, the service file is actually an abstract class that contains 415 | a set of methods which is needed in order to get data from API. 416 | ~~~dart 417 | //DO 418 | class One { 419 | Future> getEpisodes(); 420 | Future> getEpisodeDetail(); 421 | } 422 | 423 | //DON'T 424 | class One { 425 | Future myMethod(); 426 | } 427 | ~~~ 428 | 429 | ### Prefer one variable for language convention 430 | Ensure to separate the variable that represents a language, one class is supposed to have one variable. 431 | 432 | ~~~dart 433 | //DO 434 | -- languages/id_lang.dart -- 435 | Map id = {}; 436 | 437 | -- languages/en_lang.dart -- 438 | Map en = {}; 439 | 440 | 441 | //DON'T 442 | -- languages.dart -- 443 | Map id = {}; 444 | Map en = {}; 445 | ~~~ 446 | 447 | ## Example 448 | 449 | ### Incorrect services rules 450 | 451 | 452 | 453 | ### Visual Studio Code problem reports 454 | 455 | 456 |   457 | ### Other Information 458 | You can follow us at 459 | -------------------------------------------------------------------------------- /lib/glory_convention_lint.dart: -------------------------------------------------------------------------------- 1 | library glory_convention_lint; 2 | 3 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 4 | import 'rules/correct_base_response_import_convention.dart'; 5 | import 'rules/correct_one_variable_for_lang_convention.dart'; 6 | import 'rules/enum_file_name_convention.dart'; 7 | import 'rules/enum_name_convention.dart'; 8 | import 'rules/network_model_annotation_convention.dart'; 9 | import 'rules/network_model_class_name_convention.dart'; 10 | import 'rules/network_model_file_name_convention.dart'; 11 | import 'rules/network_model_json_implementation_convention.dart'; 12 | import 'rules/network_request_class_name_convention.dart'; 13 | import 'rules/network_request_file_name_convention.dart'; 14 | import 'rules/network_response_class_name_convention.dart'; 15 | import 'rules/network_response_file_name_convention.dart'; 16 | import 'rules/network_service_annotation_convention.dart'; 17 | import 'rules/network_service_class_name_convention.dart'; 18 | import 'rules/network_service_file_name_convention.dart'; 19 | import 'rules/prefer_nullable_model.dart'; 20 | import 'rules/prefer_single_class_per_file.dart'; 21 | import 'rules/prefer_single_enum_per_file.dart'; 22 | import 'rules/prefer_static_const_lang_variable.dart'; 23 | import 'rules/prefer_upper_camel_case.dart'; 24 | 25 | PluginBase createPlugin() => _RgbCustomLint(); 26 | 27 | class _RgbCustomLint extends PluginBase { 28 | @override 29 | List getLintRules(CustomLintConfigs configs) => [ 30 | const NetworkModelFileNameConvention(), 31 | const NetworkModelAnnotationConvention(), 32 | const NetworkModelClassNameConvention(), 33 | const NetworkModelJsonImplementationConvention(), 34 | const PreferNullableModel(), 35 | 36 | const NetworkServiceAnnotationConvention(), 37 | const NetworkServiceClassNameConvention(), 38 | const NetworkServiceFileNameConvention(), 39 | 40 | const NetworkResponseClassNameConvention(), 41 | const NetworkResponseFileNameConvention(), 42 | 43 | const NetworkRequestClassNameConvention(), 44 | const NetworkRequestFileNameConvention(), 45 | 46 | const EnumFileNameConvention(), 47 | const EnumNameConvention(), 48 | 49 | const CorrectBaseResponseImportConvention(), 50 | const CorrectOneVariableForLangConvention(), 51 | 52 | const PreferUpperCamelCase(), 53 | const PreferStaticConstLangVariable(), 54 | const PreferSingleClassPerFile(), 55 | const PreferSingleEnumPerFile(), 56 | ]; 57 | } -------------------------------------------------------------------------------- /lib/helper/documentation_constants.dart: -------------------------------------------------------------------------------- 1 | //Always make sure to end with # 2 | // ignore_for_file: prefer_single_quotes, unnecessary_brace_in_string_interps 3 | 4 | const baseDocumentationUrl = 5 | 'https://github.com/rollingglory/GloryConventionLint-flutter/blob/master/README.md#'; 6 | 7 | const viewDocumentation = 'View Documentation:\n'; 8 | 9 | class DocumentationConstants { 10 | static const modelClassNameConvention = 11 | "$viewDocumentation${baseDocumentationUrl}model-class-name-convention"; 12 | static const modelFileNameConvention = 13 | "${viewDocumentation}${baseDocumentationUrl}model-file-name-convention"; 14 | static const modelAnnotationConvention = 15 | "${viewDocumentation}${baseDocumentationUrl}model-annotation-convention"; 16 | static const preferNullableForModels = 17 | "${viewDocumentation}${baseDocumentationUrl}prefer-nullable-for-models"; 18 | 19 | static const serviceClassNameConvention = 20 | "${viewDocumentation}${baseDocumentationUrl}service-class-name-convention"; 21 | static const serviceFileNameConvention = 22 | "${viewDocumentation}${baseDocumentationUrl}service-file-name-convention"; 23 | static const serviceAnnotationConvention = 24 | "${viewDocumentation}${baseDocumentationUrl}service-annotation-convention"; 25 | 26 | static const enumNameConvention = 27 | "${viewDocumentation}${baseDocumentationUrl}enum-class-name-convention"; 28 | static const enumFileNameConvention = 29 | "${viewDocumentation}${baseDocumentationUrl}enum-file-name-convention"; 30 | 31 | static const requestClassNameConvention = 32 | "${viewDocumentation}${baseDocumentationUrl}request-class-name-convention"; 33 | static const requestFileNameConvention = 34 | "${viewDocumentation}${baseDocumentationUrl}request-file-name-convention"; 35 | 36 | static const responseClassNameConvention = 37 | "${viewDocumentation}${baseDocumentationUrl}response-class-name-convention"; 38 | static const responseFileNameConvention = 39 | "${viewDocumentation}${baseDocumentationUrl}response-file-name-convention"; 40 | 41 | static const namingConvention = "${viewDocumentation}${baseDocumentationUrl}naming-convention"; 42 | static const preferSingleClassPerFile = 43 | "${viewDocumentation}${baseDocumentationUrl}prefer-single-class-per-file"; 44 | static const preferStaticConstLangVariable = 45 | "${viewDocumentation}${baseDocumentationUrl}prefer-static-const-lang-variable"; 46 | static const baseResponseImportConvention = 47 | "${viewDocumentation}${baseDocumentationUrl}base-response-import-convention"; 48 | static const preferOneVariableForLanguage = 49 | "${viewDocumentation}${baseDocumentationUrl}prefer-one-variable-for-language"; 50 | } 51 | -------------------------------------------------------------------------------- /lib/helper/lint_type_constant.dart: -------------------------------------------------------------------------------- 1 | class LintTypeConstant { 2 | static const serviceLint = 'Services'; 3 | static const enumLint = 'Enum'; 4 | static const constantLint = 'Constant'; 5 | static const responseLint = 'Response'; 6 | static const requestLint = 'Request'; 7 | static const modelLint = 'Model'; 8 | } -------------------------------------------------------------------------------- /lib/helper/string_extention.dart: -------------------------------------------------------------------------------- 1 | extension LintStringExt on String { 2 | String get fileName => split('/').last; 3 | 4 | bool isFileAllowedToBeObserved() { 5 | final regExp = RegExp('.*(/lib/app/data/|/lib/data/|/lib/resources/).*'); 6 | return regExp.hasMatch(this); 7 | } 8 | 9 | bool isFileAllowedToBeObservedSrcPattern() { 10 | final regExp = RegExp('.*(/src/app/data/|/src/data/|/src/resources/).*'); 11 | return regExp.hasMatch(this); 12 | } 13 | 14 | bool isPathModel() { 15 | final regExp = RegExp('.*(/network/models/|/network/model/).*'); 16 | return regExp.hasMatch(this); 17 | } 18 | 19 | bool isPathServices() { 20 | final regExp = RegExp('.*(/network/services/|/network/service/).*'); 21 | return regExp.hasMatch(this); 22 | } 23 | 24 | bool isPathEnum() { 25 | final regExp = RegExp('.*(/enums/|/enum/).*'); 26 | return regExp.hasMatch(this); 27 | } 28 | 29 | bool isPathResponse() { 30 | final regExp = RegExp('.*(/responses/|/response/).*'); 31 | return regExp.hasMatch(this); 32 | } 33 | 34 | bool isPathRequest() { 35 | final regExp = RegExp('.*(/requests/|/request/).*'); 36 | return regExp.hasMatch(this); 37 | } 38 | 39 | bool isPathResourceConstant() { 40 | final regExp = RegExp('.*(/resources/constants/|/resources/constant/).*'); 41 | return regExp.hasMatch(this); 42 | } 43 | 44 | bool isPathLang() { 45 | final regExp = RegExp('.*(languages/en/|languages/id/).*'); 46 | return regExp.hasMatch(this); 47 | } 48 | 49 | bool isPathRGBCodeBase() { 50 | final regExp = RegExp('.*gloryconventionlintplayground/json_api/*'); 51 | return regExp.hasMatch(this); 52 | } 53 | 54 | bool isCorrectModelClassName() { 55 | final regExp = RegExp(r'.*(Services|Response|Request|Constant|Enum)$'); 56 | return !regExp.hasMatch(this); 57 | } 58 | 59 | bool isCorrectFileModelName() { 60 | final regExp = RegExp(r'_model.dart$'); 61 | return regExp.hasMatch(this); 62 | } 63 | 64 | bool isCorrectClassServiceName() { 65 | final regExp = RegExp('.*Services.*'); 66 | return regExp.hasMatch(this); 67 | } 68 | 69 | bool isCorrectFileServiceName() { 70 | final regExp = RegExp(r'_services.dart$'); 71 | return regExp.hasMatch(this); 72 | } 73 | 74 | bool isCorrectClassResponseName() { 75 | final regExp = RegExp('.*Response.*'); 76 | return regExp.hasMatch(this); 77 | } 78 | 79 | bool isCorrectFileResponseName() { 80 | final regExp = RegExp(r'_response.dart$'); 81 | return regExp.hasMatch(this); 82 | } 83 | 84 | bool isCorrectClassRequestName() { 85 | final regExp = RegExp('.*Request.*'); 86 | return regExp.hasMatch(this); 87 | } 88 | 89 | bool isCorrectFileRequestName() { 90 | final regExp = RegExp(r'_request.dart$'); 91 | return regExp.hasMatch(this); 92 | } 93 | 94 | bool isCorrectClassEnumName() { 95 | final regExp = RegExp(r".*Enum.*"); 96 | return regExp.hasMatch(this); 97 | } 98 | 99 | bool isCorrectFileEnumName() { 100 | final regExp = RegExp(r'_enum.dart$'); 101 | return regExp.hasMatch(this); 102 | } 103 | 104 | bool isCorrectClassConstantName() { 105 | final regExp = RegExp('.*Constants.*'); 106 | return regExp.hasMatch(this); 107 | } 108 | 109 | bool isCorrectFileConstantName() { 110 | final regExp = RegExp(r'_constant.dart$'); 111 | return regExp.hasMatch(this); 112 | } 113 | 114 | bool isCorrectFileLang() { 115 | final regExp = RegExp(r'_lang.dart$'); 116 | return regExp.hasMatch(this); 117 | } 118 | 119 | bool isCorrectVariableNullable() { 120 | final regExp = RegExp(r'.*\?.*'); 121 | return regExp.hasMatch(this); 122 | } 123 | 124 | bool isCorrectFileBaseResponse() { 125 | final regExp = RegExp('.*base_response.dart.*'); 126 | return regExp.hasMatch(this); 127 | } 128 | 129 | bool isCorrectUsingBaseResponse() { 130 | final regExp = RegExp('.*BaseResponse|BaseListResponse.*'); 131 | return regExp.hasMatch(this); 132 | } 133 | 134 | String renameClass({required String type}) { 135 | final rawClassName = this.rawClassName; 136 | final newClassName = rawClassName + type; 137 | return newClassName; 138 | } 139 | 140 | String get rawClassName { 141 | final words = split(RegExp('(?=[A-Z])')); 142 | // ignore: cascade_invocations 143 | words.removeWhere((w) { 144 | if (w == 'Service' || w == 'Services') { 145 | return true; 146 | } 147 | if (w == 'Enum' || w == 'Enums') { 148 | return true; 149 | } 150 | if (w == 'Constant' || w == 'Constants') { 151 | return true; 152 | } 153 | if (w == 'Response') { 154 | return true; 155 | } 156 | if (w == 'Request') { 157 | return true; 158 | } 159 | return false; 160 | }); 161 | final rawClassName = words.join(); 162 | return rawClassName; 163 | } 164 | 165 | bool isLowerCamelCase() { 166 | final camelCaseTester = RegExp(r'^[a-z]+(?:[A-Z][a-z]*)*$'); 167 | return camelCaseTester.hasMatch(this); 168 | } 169 | 170 | bool isUpperCamelCase() { 171 | final camelCaseTester = RegExp(r'^_*(?:\$+_+)*[$?A-Z][$?a-zA-Z\d]*$'); 172 | return camelCaseTester.hasMatch(this); 173 | } 174 | 175 | 176 | } 177 | -------------------------------------------------------------------------------- /lib/rules/correct_base_response_import_convention.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:analyzer/error/error.dart'; 6 | import 'package:analyzer/error/listener.dart'; 7 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 8 | import '../../helper/string_extention.dart'; 9 | 10 | class CorrectBaseResponseImportConvention extends DartLintRule { 11 | const CorrectBaseResponseImportConvention() : super(code: _incorrectImport); 12 | 13 | static const _incorrectImport = LintCode( 14 | name: 'correct_base_response_import_convention', 15 | problemMessage: 16 | '⚠️The BaseResponse and BaseListResponse must be imported from rollingglory_codebase', 17 | correctionMessage: 18 | 'Try to correct the source of your base responses. \n\n See documentation : ', 19 | errorSeverity: ErrorSeverity.WARNING); 20 | 21 | static const _baseNotImplementedError = LintCode( 22 | name: 'correct_base_response_import', 23 | problemMessage: 24 | 'This method should implement BaseResponse or BaseListResponse', 25 | correctionMessage: 'Add BaseResponse or BaseListResponse to your method', 26 | ); 27 | 28 | @override 29 | void run( 30 | CustomLintResolver resolver, 31 | ErrorReporter reporter, 32 | CustomLintContext context, 33 | ) { 34 | context.registry.addCompilationUnit( 35 | (node) { 36 | final declaredElement = node.declaredElement; 37 | if (declaredElement != null) { 38 | final path = declaredElement.source.uri.path; 39 | if (path.isPathServices()) { 40 | final classes = declaredElement.classes; 41 | for (final element in classes) { 42 | for (final field in element.methods) { 43 | if (!field.toString().isCorrectUsingBaseResponse()) { 44 | reporter.reportErrorForOffset( 45 | _baseNotImplementedError, 46 | field.nameOffset, 47 | field.nameLength, 48 | ); 49 | } 50 | } 51 | } 52 | final imports = node.directives; 53 | for (final import in imports) { 54 | if (import.toString().isCorrectFileBaseResponse()) { 55 | if (!path.isPathRGBCodeBase()) { 56 | reporter.reportErrorForOffset( 57 | code, 58 | import.offset, 59 | import.length, 60 | ); 61 | } 62 | } 63 | } 64 | } 65 | } 66 | }, 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/rules/correct_one_variable_for_lang_convention.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | import 'package:analyzer/error/listener.dart'; 5 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 6 | import '../../helper/string_extention.dart'; 7 | 8 | class CorrectOneVariableForLangConvention extends DartLintRule { 9 | const CorrectOneVariableForLangConvention() : super(code: _notAllowed); 10 | 11 | static const _notAllowed = LintCode( 12 | name: 'correct_one_variable_for_lang_convention', 13 | problemMessage: '⚠️Only one variable is allowed for lang file', 14 | correctionMessage: 'Try to remove unnecessary variables', 15 | ); 16 | 17 | @override 18 | void run( 19 | CustomLintResolver resolver, 20 | ErrorReporter reporter, 21 | CustomLintContext context, 22 | ) { 23 | context.registry.addCompilationUnit( 24 | (node) { 25 | var declaredElement = node.declaredElement; 26 | if (declaredElement != null) { 27 | var path = declaredElement.source.uri.path; 28 | if (path.isCorrectFileLang() && path.isPathLang()) { 29 | var variables = declaredElement.topLevelVariables; 30 | if (variables.length > 1) { 31 | for (int i = 1; i < variables.length; i++) { 32 | reporter.reportErrorForOffset( 33 | _notAllowed, 34 | variables[i].nameOffset, 35 | variables[i].nameLength, 36 | ); 37 | } 38 | } 39 | } 40 | } 41 | }, 42 | ); 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /lib/rules/enum_file_name_convention.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/error/error.dart'; 2 | import 'package:analyzer/error/listener.dart'; 3 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 4 | import 'package:glory_convention_lint/helper/string_extention.dart'; 5 | 6 | import '../helper/documentation_constants.dart'; 7 | 8 | class EnumFileNameConvention extends DartLintRule { 9 | const EnumFileNameConvention() : super(code: _code); 10 | 11 | static const _code = LintCode( 12 | name: 'enum_file_name_convention', 13 | problemMessage: 14 | "⚠️The file name incorrect name for enum file. file name should end with '_enum'", 15 | correctionMessage: 'Try changing the file name that ends with "_enum". Example: user_enum.dart.${DocumentationConstants.enumFileNameConvention}', 16 | errorSeverity: ErrorSeverity.WARNING 17 | ); 18 | 19 | @override 20 | void run( 21 | CustomLintResolver resolver, 22 | ErrorReporter reporter, 23 | CustomLintContext context, 24 | ) { 25 | context.registry.addCompilationUnit((node) { 26 | var declaredElement = node.declaredElement; 27 | if (declaredElement != null) { 28 | var fileName = declaredElement.source.uri.path; 29 | var enums = declaredElement.enums; 30 | 31 | if (enums.isEmpty){ 32 | if (fileName.isPathEnum()) { 33 | if (!fileName.isCorrectFileEnumName()) { 34 | reporter.reportErrorForOffset(code, 0, 0); 35 | } 36 | } 37 | return; 38 | } 39 | 40 | final offset = enums.first.nameOffset; 41 | final length = enums.first.nameLength; 42 | if (fileName.isPathEnum()) { 43 | if (!fileName.isCorrectFileEnumName()) { 44 | reporter.reportErrorForOffset(code, offset, length); 45 | } 46 | } 47 | } 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/rules/enum_name_convention.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/error/error.dart'; 2 | import 'package:analyzer/error/listener.dart'; 3 | import 'package:analyzer/source/source_range.dart'; 4 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 5 | 6 | import '../helper/documentation_constants.dart'; 7 | import '../helper/lint_type_constant.dart'; 8 | import '../helper/string_extention.dart'; 9 | 10 | class EnumNameConvention extends DartLintRule { 11 | const EnumNameConvention() : super(code: _code); 12 | 13 | static const _code = LintCode( 14 | name: 'enum_name_convention', 15 | problemMessage: '⚠️The enum name incorrect name for enum. ' 16 | 'Enum should only contains their name without prefixes. Example: GiftEnum', 17 | errorSeverity: ErrorSeverity.WARNING, 18 | correctionMessage: DocumentationConstants.enumNameConvention 19 | ); 20 | 21 | @override 22 | void run( 23 | CustomLintResolver resolver, 24 | ErrorReporter reporter, 25 | CustomLintContext context, 26 | ) { 27 | 28 | context.registry.addCompilationUnit((node) { 29 | final declaredElement = node.declaredElement; 30 | if (declaredElement != null) { 31 | final fileName = declaredElement.source.uri.path; 32 | final enums = declaredElement.enums; 33 | 34 | for (final enumInstance in enums) { 35 | final offset = enumInstance.nameOffset; 36 | final length = enumInstance.nameLength; 37 | final name = enumInstance.name; 38 | 39 | if (fileName.isPathEnum()) { 40 | if (!name.isCorrectClassEnumName()) { 41 | reporter.reportErrorForOffset(code, offset, length); 42 | } 43 | } 44 | } 45 | } 46 | }); 47 | } 48 | 49 | @override 50 | List getFixes() => [_RenameEnumsClass()]; 51 | } 52 | 53 | class _RenameEnumsClass extends DartFix { 54 | @override 55 | void run( 56 | CustomLintResolver resolver, 57 | ChangeReporter reporter, 58 | CustomLintContext context, 59 | AnalysisError analysisError, 60 | List others, 61 | ) { 62 | context.registry.addCompilationUnit((node) { 63 | final declaredElement = node.declaredElement; 64 | final enums = declaredElement?.enums; 65 | 66 | if (enums == null || enums.isEmpty) { 67 | return; 68 | } 69 | final className = enums.first.name; 70 | final correctName = className.renameClass(type: LintTypeConstant.enumLint); 71 | 72 | final offset = enums.first.nameOffset; 73 | final length = enums.first.nameLength; 74 | 75 | reporter.createChangeBuilder( 76 | message: 'Change to $correctName', 77 | priority: 1, 78 | ) 79 | .addDartFileEdit((builder) { 80 | builder.addSimpleReplacement( 81 | SourceRange(offset, length), 82 | correctName, 83 | ); 84 | }); 85 | }); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/rules/network_model_annotation_convention.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/dart/ast/ast.dart'; 2 | import 'package:analyzer/dart/element/element.dart'; 3 | import 'package:analyzer/error/error.dart'; 4 | import 'package:analyzer/error/listener.dart'; 5 | import 'package:analyzer/source/source_range.dart'; 6 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 7 | import 'package:glory_convention_lint/helper/documentation_constants.dart'; 8 | import 'package:glory_convention_lint/helper/string_extention.dart'; 9 | 10 | class NetworkModelAnnotationConvention extends DartLintRule { 11 | const NetworkModelAnnotationConvention() : super(code: _code); 12 | 13 | static const _code = LintCode( 14 | name: 'network_model_annotation_convention', 15 | problemMessage: 16 | '⚠️JsonSerializable Annotation is required to declare model for retrofit pattern.', 17 | correctionMessage: 18 | "You have to add '@JsonSerializable()' on top of your model class. \n\n${DocumentationConstants.modelAnnotationConvention}", 19 | errorSeverity: ErrorSeverity.WARNING); 20 | 21 | @override 22 | void run( 23 | CustomLintResolver resolver, 24 | ErrorReporter reporter, 25 | CustomLintContext context, 26 | ) { 27 | context.registry.addCompilationUnit((node) { 28 | final declaredElement = node.declaredElement; 29 | if (declaredElement != null) { 30 | var isLintSatisfied = false; 31 | final fileName = declaredElement.source.uri.path; 32 | final classes = declaredElement.classes; 33 | 34 | if (!fileName.isPathModel()) { 35 | return; 36 | } 37 | 38 | if (node.declarations.isEmpty) { 39 | isLintSatisfied = false; 40 | return; 41 | } 42 | 43 | for (final declaration in node.declarations) { 44 | if (declaration is ClassDeclaration) { 45 | final classAnnotations = declaration.metadata; 46 | for (final annotation in classAnnotations) { 47 | final evaluatedAnnotation = annotation.name.name; 48 | if (evaluatedAnnotation.contains('JsonSerializable')) { 49 | isLintSatisfied = true; 50 | } else { 51 | isLintSatisfied = false; 52 | } 53 | } 54 | } 55 | } 56 | 57 | if (classes.isEmpty) { 58 | return; 59 | } 60 | 61 | if (isLintSatisfied == true) { 62 | return; 63 | } 64 | 65 | final classInstance = classes.first; 66 | final offset = classInstance.nameOffset; 67 | final length = classInstance.nameLength; 68 | 69 | reporter.reportErrorForOffset(code, offset, length); 70 | } 71 | }); 72 | } 73 | 74 | @override 75 | List getFixes() => [_AddJsonAnnotation()]; 76 | } 77 | 78 | class _AddJsonAnnotation extends DartFix { 79 | @override 80 | void run( 81 | CustomLintResolver resolver, 82 | ChangeReporter reporter, 83 | CustomLintContext context, 84 | AnalysisError analysisError, 85 | List others, 86 | ) { 87 | context.registry.addCompilationUnit((node) { 88 | final declaredElement = node.declaredElement; 89 | final classes = declaredElement?.classes; 90 | const classLength = 'class '.length; 91 | 92 | if (classes == null || classes.isEmpty) return; 93 | final offset = classes.first.nameOffset; 94 | 95 | reporter.createChangeBuilder( 96 | message: 'Add @JsonSerializable()', 97 | priority: 2, 98 | ) 99 | .addDartFileEdit((builder) { 100 | builder.addSimpleReplacement( 101 | SourceRange(offset - classLength, 0), 102 | '@JsonSerializable()\n', 103 | ); 104 | }); 105 | }); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /lib/rules/network_model_class_name_convention.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/error/error.dart'; 2 | import 'package:analyzer/error/listener.dart'; 3 | import 'package:analyzer/source/source_range.dart'; 4 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 5 | 6 | import '../helper/documentation_constants.dart'; 7 | import '../helper/string_extention.dart'; 8 | 9 | class NetworkModelClassNameConvention extends DartLintRule { 10 | const NetworkModelClassNameConvention() : super(code: _code); 11 | 12 | static const _code = LintCode( 13 | name: 'network_model_class_name_convention', 14 | problemMessage: '⚠️The class name incorrect name for model class. ' 15 | 'Model class should only contains their name without prefixes. Example: Gift, User', 16 | correctionMessage: DocumentationConstants.modelClassNameConvention, 17 | errorSeverity: ErrorSeverity.WARNING 18 | ); 19 | 20 | @override 21 | void run( 22 | CustomLintResolver resolver, 23 | ErrorReporter reporter, 24 | CustomLintContext context, 25 | ) { 26 | context.registry.addCompilationUnit((node) { 27 | final declaredElement = node.declaredElement; 28 | if (declaredElement != null) { 29 | final fileName = declaredElement.source.uri.path; 30 | final classes = declaredElement.classes; 31 | 32 | for (final classInstance in classes) { 33 | final offset = classInstance.nameOffset; 34 | final length = classInstance.nameLength; 35 | final name = classInstance.name; 36 | 37 | if (fileName.isPathModel()) { 38 | if (!name.isCorrectModelClassName()) { 39 | reporter.reportErrorForOffset(code, offset, length); 40 | } 41 | } 42 | } 43 | } 44 | }); 45 | } 46 | 47 | @override 48 | List getFixes() => [_RenameModelClass()]; 49 | } 50 | 51 | class _RenameModelClass extends DartFix { 52 | @override 53 | void run( 54 | CustomLintResolver resolver, 55 | ChangeReporter reporter, 56 | CustomLintContext context, 57 | AnalysisError analysisError, 58 | List others, 59 | ) { 60 | context.registry.addCompilationUnit((node) { 61 | final declaredElement = node.declaredElement; 62 | final classes = declaredElement?.classes; 63 | 64 | if (classes == null || classes.isEmpty) return; 65 | final className = classes.first.name; 66 | final correctName = className.rawClassName; 67 | 68 | final offset = classes.first.nameOffset; 69 | final length = classes.first.nameLength; 70 | 71 | reporter.createChangeBuilder( 72 | message: 'Change to $correctName', 73 | priority: 1, 74 | ) 75 | .addDartFileEdit((builder) { 76 | builder.addSimpleReplacement( 77 | SourceRange(offset, length), 78 | correctName, 79 | ); 80 | }); 81 | }); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/rules/network_model_file_name_convention.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/error/error.dart'; 2 | import 'package:analyzer/error/listener.dart'; 3 | import 'package:analyzer/source/source_range.dart'; 4 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 5 | import 'package:glory_convention_lint/helper/string_extention.dart'; 6 | 7 | import '../helper/documentation_constants.dart'; 8 | 9 | class NetworkModelFileNameConvention extends DartLintRule { 10 | const NetworkModelFileNameConvention() : super(code: _code); 11 | 12 | static const _code = LintCode( 13 | name: 'network_model_file_name_convention', 14 | problemMessage: 15 | "⚠️The file name isn't a correct name for model file. file name should end with '_model'", 16 | correctionMessage: 'Try changing the file name that ends with "_model". Example: user_model.dart. \n\n${DocumentationConstants.modelFileNameConvention}', 17 | errorSeverity: ErrorSeverity.WARNING 18 | ); 19 | 20 | @override 21 | void run( 22 | CustomLintResolver resolver, 23 | ErrorReporter reporter, 24 | CustomLintContext context, 25 | ) { 26 | context.registry.addCompilationUnit((node) { 27 | final declaredElement = node.declaredElement; 28 | if (declaredElement != null) { 29 | final fileName = declaredElement.source.uri.path; 30 | final classes = declaredElement.classes; 31 | 32 | if (classes.isEmpty){ 33 | if (fileName.isPathModel()) { 34 | if (!fileName.isCorrectFileModelName()) { 35 | reporter.reportErrorForOffset(code, 0, 0); 36 | } 37 | } 38 | return; 39 | } 40 | 41 | final offset = classes.first.nameOffset; 42 | final length = classes.first.nameLength; 43 | if (fileName.isPathModel()) { 44 | if (!fileName.isCorrectFileModelName()) { 45 | reporter.reportErrorForOffset(code, offset, length); 46 | } 47 | } 48 | } 49 | }); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/rules/network_model_json_implementation_convention.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/dart/ast/ast.dart'; 2 | import 'package:analyzer/error/error.dart'; 3 | import 'package:analyzer/error/listener.dart'; 4 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 5 | import '../helper/string_extention.dart'; 6 | 7 | class NetworkModelJsonImplementationConvention extends DartLintRule { 8 | const NetworkModelJsonImplementationConvention() : super(code: _code); 9 | 10 | static const _code = LintCode( 11 | name: 'network_nodel_json_implementation_convention', 12 | problemMessage: '⚠️Method toJson or fromJson is not implemented', 13 | correctionMessage: 'Add toJson method and fromJson method', 14 | errorSeverity: ErrorSeverity.WARNING 15 | ); 16 | 17 | @override 18 | void run( 19 | CustomLintResolver resolver, 20 | ErrorReporter reporter, 21 | CustomLintContext context, 22 | ) { 23 | bool isFromJsonImplemented(CompilationUnitMember compilationUnitMember) { 24 | if (compilationUnitMember.toString().contains('FromJson')) { 25 | return true; 26 | } 27 | return false; 28 | } 29 | 30 | bool isToJsonImplemented(CompilationUnitMember compilationUnitMember) { 31 | if (compilationUnitMember.toString().contains('ToJson')) { 32 | return true; 33 | } 34 | return false; 35 | } 36 | 37 | context.registry.addCompilationUnit((node) { 38 | final declaredElement = node.declaredElement; 39 | final declarations = node.declarations; 40 | if (declaredElement != null && declarations.isNotEmpty) { 41 | final path = declaredElement.source.uri.path; 42 | 43 | if (path.isPathModel()) { 44 | for (final declaration in declarations) { 45 | if (!isFromJsonImplemented(declaration)) { 46 | reporter.reportErrorForOffset( 47 | code, declaration.offset, declaration.length); 48 | } 49 | if (!isToJsonImplemented(declaration)) { 50 | reporter.reportErrorForOffset( 51 | code, declaration.offset, declaration.length); 52 | } 53 | } 54 | } 55 | } 56 | }); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/rules/network_request_class_name_convention.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:analyzer/error/error.dart'; 6 | import 'package:analyzer/error/listener.dart'; 7 | import 'package:analyzer/source/source_range.dart'; 8 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 9 | import '../../helper/string_extention.dart'; 10 | import '../helper/documentation_constants.dart'; 11 | import '../helper/lint_type_constant.dart'; 12 | 13 | class NetworkRequestClassNameConvention extends DartLintRule { 14 | const NetworkRequestClassNameConvention() : super(code: _code); 15 | 16 | static const _code = LintCode( 17 | name: 'network_request_class_name_convention', 18 | problemMessage: 19 | "⚠️The class name isn't a correct name for request class. Example : 'ExampleRequest'", 20 | correctionMessage: 'Try changing the name that ends with "Request". \n\n${DocumentationConstants.requestClassNameConvention}', 21 | ); 22 | 23 | @override 24 | void run( 25 | CustomLintResolver resolver, 26 | ErrorReporter reporter, 27 | CustomLintContext context, 28 | ) { 29 | context.registry.addCompilationUnit( 30 | (node) { 31 | final declaredElement = node.declaredElement; 32 | if (declaredElement != null) { 33 | final fileName = declaredElement.source.uri.path; 34 | final classess = declaredElement.classes; 35 | 36 | for (final classInstance in classess) { 37 | final offset = classInstance.nameOffset; 38 | final length = classInstance.nameLength; 39 | final name = classInstance.name; 40 | 41 | if (fileName.isPathRequest()) { 42 | if (!name.isCorrectClassRequestName()) { 43 | reporter.reportErrorForOffset( 44 | _code, 45 | offset, 46 | length, 47 | ); 48 | } 49 | } 50 | } 51 | } 52 | }, 53 | ); 54 | } 55 | @override 56 | List getFixes() => [_RenameRequestClassName()]; 57 | } 58 | 59 | class _RenameRequestClassName extends DartFix { 60 | @override 61 | void run( 62 | CustomLintResolver resolver, 63 | ChangeReporter reporter, 64 | CustomLintContext context, 65 | AnalysisError analysisError, 66 | List others, 67 | ) { 68 | context.registry.addCompilationUnit( 69 | (node) { 70 | final declaredElement = node.declaredElement; 71 | final classes = declaredElement?.classes; 72 | 73 | if (classes == null || classes.isEmpty) return; 74 | final className = classes.first.name; 75 | final correctName = 76 | className.renameClass(type: LintTypeConstant.requestLint); 77 | 78 | final offset = classes.first.nameOffset; 79 | final length = classes.first.nameLength; 80 | 81 | reporter.createChangeBuilder( 82 | message: 'Change to $correctName', 83 | priority: 1, 84 | ) 85 | .addDartFileEdit( 86 | (builder) { 87 | builder.addSimpleReplacement( 88 | SourceRange(offset, length), 89 | correctName, 90 | ); 91 | }, 92 | ); 93 | }, 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/rules/network_request_file_name_convention.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:analyzer/error/listener.dart'; 6 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 7 | import '../../helper/string_extention.dart'; 8 | import '../helper/documentation_constants.dart'; 9 | 10 | class NetworkRequestFileNameConvention extends DartLintRule { 11 | const NetworkRequestFileNameConvention() : super(code: _code); 12 | 13 | static const _code = LintCode( 14 | name: 'network_request_file_name_convention', 15 | problemMessage: "⚠️The file name '{0}' isn't a correct name for request file.", 16 | correctionMessage: 'Try changing the name that ends with "_request". \n\n${DocumentationConstants.requestFileNameConvention}', 17 | ); 18 | 19 | @override 20 | void run( 21 | CustomLintResolver resolver, 22 | ErrorReporter reporter, 23 | CustomLintContext context, 24 | ) { 25 | context.registry.addCompilationUnit( 26 | (node) { 27 | final declaredElement = node.declaredElement; 28 | if (declaredElement != null) { 29 | final path = declaredElement.source.uri.path; 30 | if (path.isCorrectFileLang() && path.isPathLang()) { 31 | final variables = declaredElement.topLevelVariables; 32 | if (variables.length > 1) { 33 | for (int i = 1; i < variables.length; i++) { 34 | reporter.reportErrorForOffset( 35 | _code, 36 | variables[i].nameOffset, 37 | variables[i].nameLength, 38 | ); 39 | } 40 | } 41 | } 42 | } 43 | }, 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/rules/network_response_class_name_convention.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:analyzer/error/error.dart'; 6 | import 'package:analyzer/error/listener.dart'; 7 | import 'package:analyzer/source/source_range.dart'; 8 | import 'package:analyzer/src/lint/linter.dart'; 9 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 10 | import '../../helper/string_extention.dart'; 11 | import '../helper/lint_type_constant.dart'; 12 | 13 | class NetworkResponseClassNameConvention extends DartLintRule { 14 | const NetworkResponseClassNameConvention() : super(code: _code); 15 | 16 | static const _code = LintCode( 17 | name: 'network_response_class_name_convention', 18 | problemMessage: 19 | "⚠️The class name isn't a correct name for response class. Example : 'ExampleResponse'", 20 | correctionMessage: 'Try changing the name that ends with "Response".'); 21 | 22 | @override 23 | void run( 24 | CustomLintResolver resolver, 25 | ErrorReporter reporter, 26 | CustomLintContext context, 27 | ) { 28 | context.registry.addCompilationUnit( 29 | (node) { 30 | final declaredElement = node.declaredElement; 31 | if (declaredElement != null) { 32 | final fileName = declaredElement.source.uri.path; 33 | final classess = declaredElement.classes; 34 | 35 | for (final classInstance in classess) { 36 | final offset = classInstance.nameOffset; 37 | final length = classInstance.nameLength; 38 | final name = classInstance.name; 39 | 40 | if (fileName.isPathResponse()) { 41 | if (!name.isCorrectClassResponseName()) { 42 | reporter.reportErrorForOffset( 43 | _code, 44 | offset, 45 | length, 46 | [fileName], 47 | ); 48 | } 49 | } 50 | } 51 | } 52 | }, 53 | ); 54 | } 55 | @override 56 | List getFixes() => [_RenameResponseClassName()]; 57 | } 58 | 59 | class _RenameResponseClassName extends DartFix { 60 | @override 61 | void run( 62 | CustomLintResolver resolver, 63 | ChangeReporter reporter, 64 | CustomLintContext context, 65 | AnalysisError analysisError, 66 | List others, 67 | ) { 68 | context.registry.addCompilationUnit( 69 | (node) { 70 | final declaredElement = node.declaredElement; 71 | final classes = declaredElement?.classes; 72 | 73 | if (classes == null || classes.isEmpty) return; 74 | final className = classes.first.name; 75 | final correctName = 76 | className.renameClass(type: LintTypeConstant.responseLint); 77 | 78 | final offset = classes.first.nameOffset; 79 | final length = classes.first.nameLength; 80 | 81 | reporter.createChangeBuilder( 82 | message: 'Change to $correctName', 83 | priority: 1, 84 | ) 85 | .addDartFileEdit( 86 | (builder) { 87 | builder.addSimpleReplacement( 88 | SourceRange(offset, length), 89 | correctName, 90 | ); 91 | }, 92 | ); 93 | }, 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/rules/network_response_file_name_convention.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | import 'package:analyzer/error/error.dart'; 5 | import 'package:analyzer/error/listener.dart'; 6 | import 'package:analyzer/source/source_range.dart'; 7 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 8 | import '../../helper/string_extention.dart'; 9 | import '../helper/lint_type_constant.dart'; 10 | 11 | class NetworkResponseFileNameConvention extends DartLintRule { 12 | const NetworkResponseFileNameConvention() : super(code: _code); 13 | 14 | static const _code = LintCode( 15 | name: 'network_response_file_name_convention', 16 | problemMessage: 17 | "⚠️The file name '{0}' isn't a correct name for response file.", 18 | correctionMessage: 'Try changing the name that ends with "_response".', 19 | ); 20 | 21 | @override 22 | void run( 23 | CustomLintResolver resolver, 24 | ErrorReporter reporter, 25 | CustomLintContext context, 26 | ) { 27 | context.registry.addCompilationUnit( 28 | (node) { 29 | final declaredElement = node.declaredElement; 30 | if (declaredElement != null) { 31 | final path = declaredElement.source.uri.path; 32 | final classess = declaredElement.classes; 33 | 34 | for (final classInstance in classess) { 35 | final offset = classInstance.nameOffset; 36 | final length = classInstance.nameLength; 37 | 38 | if (path.isPathResponse()) { 39 | if (!path.isCorrectFileResponseName()) { 40 | reporter.reportErrorForOffset(_code, offset, length); 41 | } 42 | } 43 | } 44 | } 45 | }, 46 | ); 47 | } 48 | @override 49 | List getFixes() => [_RenameResponseClass()]; 50 | } 51 | 52 | class _RenameResponseClass extends DartFix { 53 | @override 54 | void run( 55 | CustomLintResolver resolver, 56 | ChangeReporter reporter, 57 | CustomLintContext context, 58 | AnalysisError analysisError, 59 | List others, 60 | ) { 61 | context.registry.addCompilationUnit((node) { 62 | final declaredElement = node.declaredElement; 63 | final classes = declaredElement?.classes; 64 | 65 | if (classes == null || classes.isEmpty) return; 66 | final className = classes.first.name; 67 | final correctName = className.renameClass(type: LintTypeConstant.responseLint); 68 | 69 | final offset = classes.first.nameOffset; 70 | final length = classes.first.nameLength; 71 | 72 | reporter.createChangeBuilder( 73 | message: 'Change to $correctName', 74 | priority: 1, 75 | ) 76 | .addDartFileEdit((builder) { 77 | builder.addSimpleReplacement( 78 | SourceRange(offset, length), 79 | correctName, 80 | ); 81 | }); 82 | }); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/rules/network_service_annotation_convention.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/dart/ast/ast.dart'; 2 | import 'package:analyzer/dart/element/element.dart'; 3 | import 'package:analyzer/error/error.dart'; 4 | import 'package:analyzer/error/listener.dart'; 5 | import 'package:analyzer/source/source_range.dart'; 6 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 7 | 8 | import '../helper/documentation_constants.dart'; 9 | import '../helper/string_extention.dart'; 10 | 11 | //correct_network_service.. 12 | 13 | class NetworkServiceAnnotationConvention extends DartLintRule { 14 | const NetworkServiceAnnotationConvention() : super(code: _code); 15 | 16 | static const _code = LintCode( 17 | name: 'network_service_annotation_convention', 18 | problemMessage: 19 | '⚠️RestApi Annotation is required to declare service for retrofit pattern.', 20 | correctionMessage: 21 | "You have to add '@RestApi()' on top of your model class, \n\n${DocumentationConstants.serviceAnnotationConvention}", 22 | errorSeverity: ErrorSeverity.WARNING); 23 | 24 | @override 25 | void run( 26 | CustomLintResolver resolver, 27 | ErrorReporter reporter, 28 | CustomLintContext context, 29 | ) { 30 | context.registry.addCompilationUnit((node) { 31 | final declaredElement = node.declaredElement; 32 | if (declaredElement != null) { 33 | var isLintSatisfied = false; 34 | final fileName = declaredElement.source.uri.path; 35 | final classes = declaredElement.classes; 36 | 37 | if (!fileName.isPathServices()) { 38 | return; 39 | } 40 | 41 | if (node.declarations.isEmpty) { 42 | isLintSatisfied = false; 43 | return; 44 | } 45 | 46 | for (final declaration in node.declarations) { 47 | if (declaration is ClassDeclaration) { 48 | final classAnnotations = declaration.metadata; 49 | for (var annotation in classAnnotations) { 50 | final evaluatedAnnotation = annotation.name.name; 51 | if (evaluatedAnnotation.contains('RestApi')) { 52 | isLintSatisfied = true; 53 | } else { 54 | isLintSatisfied = false; 55 | } 56 | } 57 | } 58 | } 59 | 60 | if (classes.isEmpty) { 61 | return; 62 | } 63 | 64 | if (isLintSatisfied == true) { 65 | return; 66 | } 67 | 68 | final classInstance = classes.first; 69 | final offset = classInstance.nameOffset; 70 | 71 | final length = classInstance.nameLength; 72 | 73 | reporter.reportErrorForOffset(code, offset, length); 74 | } 75 | }); 76 | } 77 | 78 | @override 79 | List getFixes() => [_AddRestApiAnnotation()]; 80 | } 81 | 82 | class _AddRestApiAnnotation extends DartFix { 83 | @override 84 | void run( 85 | CustomLintResolver resolver, 86 | ChangeReporter reporter, 87 | CustomLintContext context, 88 | AnalysisError analysisError, 89 | List others, 90 | ) { 91 | context.registry.addCompilationUnit((node) { 92 | final declaredElement = node.declaredElement; 93 | final classes = declaredElement?.classes; 94 | const classLength = 'abstract class '.length; 95 | 96 | if (classes == null || classes.isEmpty) return; 97 | final offset = classes.first.nameOffset; 98 | 99 | reporter.createChangeBuilder( 100 | message: 'Add @RestApi()', 101 | priority: 2, 102 | ).addDartFileEdit((builder) { 103 | builder.addSimpleReplacement( 104 | SourceRange(offset - classLength, 0), 105 | '@RestApi()\n', 106 | ); 107 | }); 108 | }); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /lib/rules/network_service_class_name_convention.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/error/error.dart'; 2 | import 'package:analyzer/error/listener.dart'; 3 | import 'package:analyzer/source/source_range.dart'; 4 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 5 | 6 | import '../helper/documentation_constants.dart'; 7 | import '../helper/lint_type_constant.dart'; 8 | import '../helper/string_extention.dart'; 9 | 10 | class NetworkServiceClassNameConvention extends DartLintRule { 11 | const NetworkServiceClassNameConvention() : super(code: _code); 12 | 13 | static const _code = LintCode( 14 | name: 'network_service_class_name_convention', 15 | problemMessage: "⚠️The class name isn't a correct name for service class. " 16 | "Services class should end with 'Services'. Example: GiftServices", 17 | errorSeverity: ErrorSeverity.WARNING, 18 | correctionMessage: DocumentationConstants.serviceClassNameConvention 19 | 20 | ); 21 | 22 | @override 23 | void run( 24 | CustomLintResolver resolver, 25 | ErrorReporter reporter, 26 | CustomLintContext context, 27 | ) { 28 | context.registry.addCompilationUnit((node) { 29 | final declaredElement = node.declaredElement; 30 | if (declaredElement != null) { 31 | final fileName = declaredElement.source.uri.path; 32 | final classes = declaredElement.classes; 33 | 34 | for (final classInstance in classes) { 35 | final offset = classInstance.nameOffset; 36 | final length = classInstance.nameLength; 37 | final name = classInstance.name; 38 | 39 | if (fileName.isPathServices()) { 40 | if (!name.isCorrectClassServiceName()) { 41 | reporter.reportErrorForOffset(code, offset, length); 42 | } 43 | } 44 | } 45 | } 46 | }); 47 | } 48 | 49 | @override 50 | List getFixes() => [_RenameServicesClass()]; 51 | } 52 | 53 | class _RenameServicesClass extends DartFix { 54 | @override 55 | void run( 56 | CustomLintResolver resolver, 57 | ChangeReporter reporter, 58 | CustomLintContext context, 59 | AnalysisError analysisError, 60 | List others, 61 | ) { 62 | context.registry.addCompilationUnit((node) { 63 | final declaredElement = node.declaredElement; 64 | final classes = declaredElement?.classes; 65 | 66 | if (classes == null || classes.isEmpty) return; 67 | final className = classes.first.name; 68 | final correctName = className.renameClass(type: LintTypeConstant.serviceLint); 69 | 70 | final offset = classes.first.nameOffset; 71 | final length = classes.first.nameLength; 72 | 73 | reporter.createChangeBuilder( 74 | message: 'Change to $correctName', 75 | priority: 1, 76 | ).addDartFileEdit((builder) { 77 | builder.addSimpleReplacement( 78 | SourceRange(offset, length), 79 | correctName, 80 | ); 81 | }); 82 | }); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/rules/network_service_file_name_convention.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/error/error.dart'; 2 | import 'package:analyzer/error/listener.dart'; 3 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 4 | 5 | import '../helper/documentation_constants.dart'; 6 | import '../helper/string_extention.dart'; 7 | 8 | class NetworkServiceFileNameConvention extends DartLintRule { 9 | const NetworkServiceFileNameConvention() : super(code: _code); 10 | 11 | static const _code = LintCode( 12 | name: 'network_service_file_name_convention', 13 | problemMessage: 14 | "⚠️The file name isn't a correct name for services file. file name should end with '_services'", 15 | correctionMessage: 'Try changing the file name that ends with "_services". Example: user_services.dart. \n\n${DocumentationConstants.serviceFileNameConvention}', 16 | errorSeverity: ErrorSeverity.WARNING 17 | 18 | ); 19 | 20 | @override 21 | void run( 22 | CustomLintResolver resolver, 23 | ErrorReporter reporter, 24 | CustomLintContext context, 25 | ) { 26 | context.registry.addCompilationUnit((node) { 27 | final declaredElement = node.declaredElement; 28 | if (declaredElement != null) { 29 | final fileName = declaredElement.source.uri.path; 30 | final classes = declaredElement.classes; 31 | 32 | if (classes.isEmpty){ 33 | if (fileName.isPathServices()) { 34 | if (!fileName.isCorrectFileServiceName()) { 35 | reporter.reportErrorForOffset(code, 0, 0); 36 | } 37 | } 38 | return; 39 | } 40 | 41 | final offset = classes.first.nameOffset; 42 | final length = classes.first.nameLength; 43 | if (fileName.isPathServices()) { 44 | if (!fileName.isCorrectFileServiceName()) { 45 | reporter.reportErrorForOffset(code, offset, length); 46 | } 47 | } 48 | } 49 | }); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/rules/prefer_nullable_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/error/error.dart'; 2 | import 'package:analyzer/error/listener.dart'; 3 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 4 | import '../helper/string_extention.dart'; 5 | 6 | class PreferNullableModel extends DartLintRule { 7 | const PreferNullableModel() : super(code: _code); 8 | 9 | static const _code = LintCode( 10 | name: 'prefer_nullable_model', 11 | problemMessage: '⚠️Implement nullable attributes for models', 12 | correctionMessage: "add nullable to models's attributes", 13 | errorSeverity: ErrorSeverity.WARNING 14 | 15 | ); 16 | 17 | @override 18 | void run( 19 | CustomLintResolver resolver, 20 | ErrorReporter reporter, 21 | CustomLintContext context, 22 | ) { 23 | context.registry.addCompilationUnit((node) { 24 | final declaredElement = node.declaredElement; 25 | if (declaredElement != null) { 26 | final path = declaredElement.source.uri.path; 27 | if (path.isCorrectFileModelName() && path.isPathModel()) { 28 | for (final element in declaredElement.classes) { 29 | for (final field in element.fields) { 30 | if (!field.toString().isCorrectVariableNullable()) { 31 | reporter.reportErrorForOffset(code, field.nameOffset, field.nameLength); 32 | } 33 | } 34 | } 35 | } 36 | } 37 | }); 38 | } 39 | } -------------------------------------------------------------------------------- /lib/rules/prefer_single_class_per_file.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/error/error.dart'; 2 | import 'package:analyzer/error/listener.dart'; 3 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 4 | 5 | class PreferSingleClassPerFile extends DartLintRule { 6 | const PreferSingleClassPerFile() : super(code: _code); 7 | 8 | static const _code = LintCode( 9 | name: 'prefer_single_class_per_file', 10 | problemMessage: '⚠️Theres only should be one class per file', 11 | correctionMessage: 'Movie class to another file \n\n', 12 | errorSeverity: ErrorSeverity.WARNING); 13 | 14 | @override 15 | void run( 16 | CustomLintResolver resolver, 17 | ErrorReporter reporter, 18 | CustomLintContext context, 19 | ) { 20 | context.registry.addCompilationUnit((node) { 21 | final declaredElement = node.declaredElement; 22 | if (declaredElement != null) { 23 | final classess = declaredElement.classes; 24 | 25 | if (classess.length > 1) { 26 | for (final classInstance in classess) { 27 | final offset = classInstance.nameOffset; 28 | final length = classInstance.nameLength; 29 | 30 | reporter.reportErrorForOffset(code, offset, length); 31 | } 32 | } 33 | } 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/rules/prefer_single_enum_per_file.dart: -------------------------------------------------------------------------------- 1 | import 'package:analyzer/error/error.dart'; 2 | import 'package:analyzer/error/listener.dart'; 3 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 4 | 5 | class PreferSingleEnumPerFile extends DartLintRule { 6 | const PreferSingleEnumPerFile() : super(code: _code); 7 | 8 | static const _code = LintCode( 9 | name: 'prefer_single_enum_per_file', 10 | problemMessage: '⚠️Theres only should be one enum per file', 11 | correctionMessage: 'Move enum to another file \n\n', 12 | errorSeverity: ErrorSeverity.WARNING); 13 | 14 | @override 15 | void run( 16 | CustomLintResolver resolver, 17 | ErrorReporter reporter, 18 | CustomLintContext context, 19 | ) { 20 | context.registry.addCompilationUnit((node) { 21 | final declaredElement = node.declaredElement; 22 | if (declaredElement != null) { 23 | final enums = declaredElement.enums; 24 | 25 | if (enums.length > 1) { 26 | for (var enumInstance in enums) { 27 | final offset = enumInstance.nameOffset; 28 | final length = enumInstance.nameLength; 29 | 30 | reporter.reportErrorForOffset(code, offset, length); 31 | } 32 | } 33 | } 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/rules/prefer_static_const_lang_variable.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:analyzer/error/listener.dart'; 6 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 7 | import '../../helper/string_extention.dart'; 8 | 9 | class PreferStaticConstLangVariable extends DartLintRule { 10 | const PreferStaticConstLangVariable() : super(code: _code); 11 | 12 | static const _code = LintCode( 13 | name: 'prefer_static_const_lang_variable', 14 | problemMessage: '⚠️It is better to use static const variables.', 15 | correctionMessage: 'Try add static const to the variable.'); 16 | 17 | @override 18 | void run( 19 | CustomLintResolver resolver, 20 | ErrorReporter reporter, 21 | CustomLintContext context, 22 | ) { 23 | context.registry.addVariableDeclarationList( 24 | (node) { 25 | final variables = node.variables; 26 | String sourceCode = node.toSource(); 27 | if (sourceCode.isPathLang()) { 28 | for (final variable in variables) { 29 | if (!variable.isConst) { 30 | reporter.reportErrorForToken(_code, variable.name); 31 | } 32 | } 33 | } 34 | }, 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/rules/prefer_upper_camel_case.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file 2 | // for details. All rights reserved. Use of this source code is governed by a 3 | // BSD-style license that can be found in the LICENSE file. 4 | 5 | import 'package:analyzer/dart/ast/token.dart'; 6 | import 'package:analyzer/error/listener.dart'; 7 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 8 | import '../../helper/string_extention.dart'; 9 | 10 | class PreferUpperCamelCase extends DartLintRule { 11 | const PreferUpperCamelCase() : super(code: _code); 12 | 13 | static const _code = LintCode( 14 | name: 'prefer_upper_camel_case', 15 | problemMessage: "⚠️The type name '{0}' isn't an UpperCamelCase identifier.", 16 | correctionMessage: 'Try changing the name to follow the UpperCamelCase style. example: GiftService', 17 | ); 18 | 19 | @override 20 | void run(CustomLintResolver resolver, ErrorReporter reporter, 21 | CustomLintContext context) { 22 | void check(Token name) { 23 | final lexeme = name.lexeme; 24 | if (!lexeme.isUpperCamelCase()) { 25 | reporter.reportErrorForToken( 26 | _code, 27 | name, 28 | [lexeme], 29 | ); 30 | } 31 | } 32 | 33 | context.registry.addClassDeclaration((node) { 34 | check(node.name); 35 | }); 36 | context.registry.addClassTypeAlias((node) { 37 | check(node.name); 38 | }); 39 | context.registry.addEnumDeclaration((node) { 40 | check(node.name); 41 | }); 42 | context.registry.addFunctionTypeAlias((node) { 43 | check(node.name); 44 | }); 45 | context.registry.addGenericTypeAlias((node) { 46 | check(node.name); 47 | }); 48 | context.registry.addPatternVariableDeclaration((node) { 49 | //check(node.equals); 50 | }); 51 | context.registry.addExtensionDeclaration( 52 | (node) { 53 | final name = node.name; 54 | if (name != null) { 55 | check(name); 56 | } 57 | }, 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /playground/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /playground/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 17 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 18 | - platform: android 19 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 20 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 21 | - platform: ios 22 | create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 23 | base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf 24 | 25 | # User provided section 26 | 27 | # List of Local paths (relative to this file) that should be 28 | # ignored by the migrate tool. 29 | # 30 | # Files that are not part of the templates will be ignored by default. 31 | unmanaged_files: 32 | - 'lib/main.dart' 33 | - 'ios/Runner.xcodeproj/project.pbxproj' 34 | -------------------------------------------------------------------------------- /playground/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **RollingGlory** is Company or Creative Digital Media studio based in Bandung, Indonesia. 4 | 5 |   6 |   7 | # GloryConventionLint-Flutter 8 | GloryConventionLint is code judgment for Convention Lint Flutter support IDE Android Studio/ Visual Studio Code. 9 |   10 | 11 | 12 | 13 | ## Setup 14 | - add glory_convention_lint into `package.yaml` 15 | 16 | ~~~yaml 17 | dev_dependencies: 18 | glory_convention_lint: ^0.0.1 19 | custom_lint: ^0.2.5 20 | ~~~ 21 | 22 | - add plugin analyzer into `analysis_options.yaml` 23 | 24 | 25 | ~~~yaml 26 | analyzer: 27 | plugins: 28 | - custom_lint 29 | ~~~ 30 | 31 | 32 | ## Convention 33 | 34 | #### Model Convention 35 | * [Model class name convention](#model-class-name-convention) 36 | * [Model file name convention](#model-file-name-convention) 37 | * [Model annotation convention](#model-annotation-convention) 38 | * [Prefer nullable for models convention](#prefer-nullable-for-models-convention) 39 | 40 | #### Service Convention 41 | * [Service class name convention](#service-class-name-convention) 42 | * [Service file name convention](#service-file-name-convention) 43 | * [Service annotation convention](#service-annotation-convention) 44 | 45 | #### Enum Convention 46 | * [Enum class name convention](#enum-class-name-convention) 47 | * [Enum file name convention](#enum-file-name-convention) 48 | 49 | #### Request Convention 50 | * [Request class name convention](#request-class-name-convention) 51 | * [Request file name convention](#request-file-name-convention) 52 | 53 | #### Response Convention 54 | * [Response class name convention](#response-class-name-convention) 55 | * [Response file name convention](#response-file-name-convention) 56 | 57 | #### Other Convention 58 | * [Naming Convention](#naming-convention) 59 | * [Prefer single class per file convention](#prefer-single-class-per-file-convention) 60 | * [Prefer static const lang variable convention](#prefer-static-const-lang-variable-convention) 61 | * [Base response import convention](#base-response-import-convention) 62 | * [One variable for lang convention](#prefer-one-variable-for-language-convention) 63 | 64 |   65 | ## Example 66 | 67 | #### Model Convention Example 68 | * [Model class name convention example](#model-class-name-convention-example) 69 | * [Model file name convention example](#model-file-name-convention-example) 70 | * [Model annotation convention example](#model-annotation-convention-example) 71 | * [Prefer nullable for models convention example](#prefer-nullable-for-models-convention-example) 72 | 73 | #### Service Convention Example 74 | * [Service class name convention example](#service-class-name-convention-example) 75 | * [Service file name convention example](#service-file-name-convention-example) 76 | * [Service annotation convention example](#service-annotation-convention-example) 77 | 78 | #### Enum Convention Example 79 | * [Enum class name convention example](#enum-class-name-convention-example) 80 | * [Enum file name convention example](#enum-file-name-convention-example) 81 | 82 |   83 | --- 84 | # Convention 85 | ## Model Convention 86 | ### Model class name convention 87 | Ensure to add Model word at the end of class name in models file 88 | ~~~dart 89 | //DO 90 | class ProductModel {} 91 | //DON'T 92 | class ProductModel {} 93 | ~~~ 94 | ### Model file name convention 95 | The file name for models must end with _model.dart 96 | ~~~dart 97 | //DO 98 | product_model.dart 99 | //DON'T 100 | product.dart 101 | productmodel.dart 102 | ``` 103 | ~~~ 104 | ### Model annotation convention 105 | Add @JsonSerializable() from Retrofit to above your class model name 106 | ~~~dart 107 | //DO 108 | @JsonSerializable() 109 | class ProductModel { 110 | int? id; 111 | } 112 | //DON'T 113 | class ProductModel { 114 | int? id; 115 | } 116 | @JsonSerializable() 117 | ~~~ 118 | ### Refer nullable for models convention 119 | Fields of Model class is preferable to have nullable field. example : String? instead of String 120 | ~~~dart 121 | //DO 122 | class Product { 123 | String? name; 124 | Product({this.name}); 125 | } 126 | //DON'T 127 | class Product { 128 | String name; 129 | Product({this.name}); 130 | } 131 | ~~~ 132 | 133 | ## Service Convention 134 | #### Service class name convention 135 | Ensure to add Services word at the end of class name in models file 136 | ~~~dart 137 | //DO 138 | class GiftServices{} 139 | class ProductServices{} 140 | //DON'T 141 | class Gift{} 142 | class ProductService{} // singular instead of plural 143 | ~~~ 144 | ### Service file name convention 145 | The file name for services must end with service.dart 146 | ~~~dart 147 | //DO 148 | gift_services.dart 149 | product_services.dart 150 | //DON'T 151 | product_service.dart //singular instead of plural 152 | ProductRequest.dart 153 | ~~~ 154 | ### Service annotation convention 155 | Add @RestApi() from Retrofit to above your class service name 156 | ~~~dart 157 | //DO 158 | @RestApi() //RestApi Annotation is added 159 | abstract class ProductServices {} 160 | //DON'T 161 | //Forget to add RestApi Annotation 162 | abstract class ProductServices {} 163 | ~~~ 164 | 165 | ## Enum Convention 166 | #### Enum class name convention 167 | Ensure to add Enum word at the end of enum class name in the file. 168 | ~~~dart 169 | //DO 170 | enum AvatarEnum {} 171 | //DON'T 172 | enum EnumAvatar {} 173 | ~~~ 174 | 175 | ### Enum file name convention 176 | Ensure to add _enum.dart prefix at the end of file name. 177 | ~~~dart 178 | //DO 179 | gift_enum.dart 180 | product_enum.dart 181 | //DON'T 182 | ProductEnum.dart 183 | ~~~ 184 | 185 | ## Request Convention 186 | ### Request class name convention 187 | Request class always end with "Request", and must use *PascalCase*. 188 | ~~~dart 189 | //DO 190 | class GiftRequest{} 191 | class ProductRequest{} 192 | 193 | //DON'T 194 | class Gift{} 195 | class product_request{} 196 | ~~~ 197 | 198 | ### Request file name convention 199 | Request file must always end with "_request" and should always use *snake_case* for file naming. 200 | ~~~ 201 | //DO 202 | product_request.dart 203 | 204 | //DON'T 205 | ProductRequest.dart 206 | ~~~ 207 | Request file must always be put inside of request directory. 208 | ~~~ 209 | |- data 210 | |- network 211 | |- request 212 | ~~~ 213 |   214 | ## Response Convention 215 | ### Response class name convention 216 | Response class always end with "Response", and must use *PascalCase*. 217 | ~~~dart 218 | //DO 219 | class GiftResponse{} 220 | class ProductResponse{} 221 | 222 | //DON'T 223 | class Gift{} 224 | class product_response{} 225 | ~~~ 226 | 227 | ### Response file name convention 228 | Response file must always end with "_response" and should always use *snake_case* for file naming. 229 | ~~~ 230 | //DO 231 | product_response.dart 232 | 233 | //DON'T 234 | ProductResponse.dart 235 | ~~~ 236 | Response file must always be put inside of response directory. 237 | ~~~ 238 | |- data 239 | |- network 240 | |- response 241 | ~~~ 242 | 243 |   244 | ## Other Convention 245 | ### Naming Convention 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 |
 
PascalCaseCamelCasePluralSnakeCaseExamples
Classclass ModelResponse{}
Service Classclass ModelServices{}
Constant Classclass NetworkConstants{}
Extensionextension StringExtensions on String
Fieldint id;
Variableint variable;
Local variableint _variable;
ParameterString param
Methodvoid methodName(){}
Local Methodvoid _methodName(){}
Enum Typeenum Status{}
348 | 349 | #### Prefer single class per file convention 350 | Avoid Declaring multiple classes in one file. It is best practice to declare one class in one file instead of multiple of class in one files, to reduce 351 | confusion. 352 | ~~~dart 353 | //DO 354 | -- test.dart -- 355 | class One = {}; 356 | 357 | //DON'T 358 | -- test.dart -- 359 | class One = {}; 360 | class Two = {}; 361 | ~~~ 362 | 363 | #### Prefer static const lang variable convention 364 | Declare variable as static const. 365 | ~~~dart 366 | //DO 367 | class One { 368 | static const variableOne = "Value" 369 | } 370 | 371 | //DON'T 372 | class One { 373 | String variableOne = "Value"; 374 | } 375 | ~~~ 376 | 377 | #### Base response import convention 378 | Both BaseResponse and BaseListResponse must be implemented and imported from rollingglory_codebase 379 | When an application communicates to the backend via API calls, we usually receive two type of responses. single object and multi objects. 380 | both types need to be implemented in service file, the service file is actually an abstract class that contains 381 | a set of methods which is needed in order to get data from API. 382 | ~~~dart 383 | //DO 384 | class One { 385 | Future> getEpisodes(); 386 | Future> getEpisodeDetail(); 387 | } 388 | 389 | //DON'T 390 | class One { 391 | Future myMethod(); 392 | } 393 | ~~~ 394 | 395 | #### Prefer one variable for language convention 396 | Ensure to separate the variable that represents a language, one class is supposed to have one variable. 397 | 398 | ~~~dart 399 | //DO 400 | -- languages/id_lang.dart -- 401 | Map id = {}; 402 | 403 | -- languages/en_lang.dart -- 404 | Map en = {}; 405 | 406 | 407 | //DON'T 408 | -- languages.dart -- 409 | Map id = {}; 410 | Map en = {}; 411 | ~~~ 412 | 413 | ## Example 414 | #### Model Convention 415 | #### Model class name convention example 416 | 417 | 418 | #### Model file name convention example 419 | 420 | 421 | #### Model annotation convention example 422 | 423 | 424 | #### Prefer nullable for models convention example 425 | 426 | 427 | 428 | #### Service Convention 429 | #### Service class name convention example 430 | 431 | 432 | #### Service file name convention example 433 | 434 | 435 | #### Service annotation convention example 436 | 437 | 438 | #### Enum Convention 439 | #### Enum class name convention example 440 | 441 | 442 | #### Enum file name convention example 443 | 444 | 445 |   446 | ### Other Information 447 | You can follow us at 448 | -------------------------------------------------------------------------------- /playground/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | analyzer: 13 | plugins: 14 | - custom_lint 15 | 16 | linter: 17 | # The lint rules applied to this project can be customized in the 18 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 19 | # included above or to enable additional rules. A list of all available lints 20 | # and their documentation is published at 21 | # https://dart-lang.github.io/linter/lints/index.html. 22 | # 23 | # Instead of disabling a lint rule for the entire project in the 24 | # section below, it can also be suppressed for a single line of code 25 | # or a specific dart file by using the `// ignore: name_of_lint` and 26 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 27 | # producing the lint. 28 | rules: 29 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 30 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 31 | 32 | # Additional information about this file can be found at 33 | # https://dart.dev/guides/language/analysis-options 34 | -------------------------------------------------------------------------------- /playground/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /playground/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.rgb_lint_playground" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /playground/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /playground/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /playground/android/app/src/main/kotlin/com/example/rgb_lint_playground/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.rgb_lint_playground 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /playground/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /playground/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /playground/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /playground/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /playground/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /playground/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /playground/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /playground/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /playground/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /playground/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /playground/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /playground/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /playground/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /playground/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /playground/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /playground/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /playground/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /playground/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /playground/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1300; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | alwaysOutOfDate = 1; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | ); 178 | inputPaths = ( 179 | ); 180 | name = "Thin Binary"; 181 | outputPaths = ( 182 | ); 183 | runOnlyForDeploymentPostprocessing = 0; 184 | shellPath = /bin/sh; 185 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 186 | }; 187 | 9740EEB61CF901F6004384FC /* Run Script */ = { 188 | isa = PBXShellScriptBuildPhase; 189 | alwaysOutOfDate = 1; 190 | buildActionMask = 2147483647; 191 | files = ( 192 | ); 193 | inputPaths = ( 194 | ); 195 | name = "Run Script"; 196 | outputPaths = ( 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | shellPath = /bin/sh; 200 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 201 | }; 202 | /* End PBXShellScriptBuildPhase section */ 203 | 204 | /* Begin PBXSourcesBuildPhase section */ 205 | 97C146EA1CF9000F007C117D /* Sources */ = { 206 | isa = PBXSourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 210 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXSourcesBuildPhase section */ 215 | 216 | /* Begin PBXVariantGroup section */ 217 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 218 | isa = PBXVariantGroup; 219 | children = ( 220 | 97C146FB1CF9000F007C117D /* Base */, 221 | ); 222 | name = Main.storyboard; 223 | sourceTree = ""; 224 | }; 225 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | 97C147001CF9000F007C117D /* Base */, 229 | ); 230 | name = LaunchScreen.storyboard; 231 | sourceTree = ""; 232 | }; 233 | /* End PBXVariantGroup section */ 234 | 235 | /* Begin XCBuildConfiguration section */ 236 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 237 | isa = XCBuildConfiguration; 238 | buildSettings = { 239 | ALWAYS_SEARCH_USER_PATHS = NO; 240 | CLANG_ANALYZER_NONNULL = YES; 241 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 242 | CLANG_CXX_LIBRARY = "libc++"; 243 | CLANG_ENABLE_MODULES = YES; 244 | CLANG_ENABLE_OBJC_ARC = YES; 245 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_COMMA = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INFINITE_RECURSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 260 | CLANG_WARN_STRICT_PROTOTYPES = YES; 261 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 262 | CLANG_WARN_UNREACHABLE_CODE = YES; 263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 264 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu99; 270 | GCC_NO_COMMON_BLOCKS = YES; 271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 273 | GCC_WARN_UNDECLARED_SELECTOR = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 275 | GCC_WARN_UNUSED_FUNCTION = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 278 | MTL_ENABLE_DEBUG_INFO = NO; 279 | SDKROOT = iphoneos; 280 | SUPPORTED_PLATFORMS = iphoneos; 281 | TARGETED_DEVICE_FAMILY = "1,2"; 282 | VALIDATE_PRODUCT = YES; 283 | }; 284 | name = Profile; 285 | }; 286 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 287 | isa = XCBuildConfiguration; 288 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | CLANG_ENABLE_MODULES = YES; 292 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 293 | ENABLE_BITCODE = NO; 294 | INFOPLIST_FILE = Runner/Info.plist; 295 | LD_RUNPATH_SEARCH_PATHS = ( 296 | "$(inherited)", 297 | "@executable_path/Frameworks", 298 | ); 299 | PRODUCT_BUNDLE_IDENTIFIER = com.example.rgbLintPlayground; 300 | PRODUCT_NAME = "$(TARGET_NAME)"; 301 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 302 | SWIFT_VERSION = 5.0; 303 | VERSIONING_SYSTEM = "apple-generic"; 304 | }; 305 | name = Profile; 306 | }; 307 | 97C147031CF9000F007C117D /* Debug */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ALWAYS_SEARCH_USER_PATHS = NO; 311 | CLANG_ANALYZER_NONNULL = YES; 312 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 313 | CLANG_CXX_LIBRARY = "libc++"; 314 | CLANG_ENABLE_MODULES = YES; 315 | CLANG_ENABLE_OBJC_ARC = YES; 316 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 317 | CLANG_WARN_BOOL_CONVERSION = YES; 318 | CLANG_WARN_COMMA = YES; 319 | CLANG_WARN_CONSTANT_CONVERSION = YES; 320 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 321 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 322 | CLANG_WARN_EMPTY_BODY = YES; 323 | CLANG_WARN_ENUM_CONVERSION = YES; 324 | CLANG_WARN_INFINITE_RECURSION = YES; 325 | CLANG_WARN_INT_CONVERSION = YES; 326 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 327 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 328 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 329 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 330 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 331 | CLANG_WARN_STRICT_PROTOTYPES = YES; 332 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 333 | CLANG_WARN_UNREACHABLE_CODE = YES; 334 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 335 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 336 | COPY_PHASE_STRIP = NO; 337 | DEBUG_INFORMATION_FORMAT = dwarf; 338 | ENABLE_STRICT_OBJC_MSGSEND = YES; 339 | ENABLE_TESTABILITY = YES; 340 | GCC_C_LANGUAGE_STANDARD = gnu99; 341 | GCC_DYNAMIC_NO_PIC = NO; 342 | GCC_NO_COMMON_BLOCKS = YES; 343 | GCC_OPTIMIZATION_LEVEL = 0; 344 | GCC_PREPROCESSOR_DEFINITIONS = ( 345 | "DEBUG=1", 346 | "$(inherited)", 347 | ); 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 355 | MTL_ENABLE_DEBUG_INFO = YES; 356 | ONLY_ACTIVE_ARCH = YES; 357 | SDKROOT = iphoneos; 358 | TARGETED_DEVICE_FAMILY = "1,2"; 359 | }; 360 | name = Debug; 361 | }; 362 | 97C147041CF9000F007C117D /* Release */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ALWAYS_SEARCH_USER_PATHS = NO; 366 | CLANG_ANALYZER_NONNULL = YES; 367 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 368 | CLANG_CXX_LIBRARY = "libc++"; 369 | CLANG_ENABLE_MODULES = YES; 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 372 | CLANG_WARN_BOOL_CONVERSION = YES; 373 | CLANG_WARN_COMMA = YES; 374 | CLANG_WARN_CONSTANT_CONVERSION = YES; 375 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 376 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN_ENUM_CONVERSION = YES; 379 | CLANG_WARN_INFINITE_RECURSION = YES; 380 | CLANG_WARN_INT_CONVERSION = YES; 381 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 383 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 385 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 386 | CLANG_WARN_STRICT_PROTOTYPES = YES; 387 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 388 | CLANG_WARN_UNREACHABLE_CODE = YES; 389 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 390 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 391 | COPY_PHASE_STRIP = NO; 392 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 393 | ENABLE_NS_ASSERTIONS = NO; 394 | ENABLE_STRICT_OBJC_MSGSEND = YES; 395 | GCC_C_LANGUAGE_STANDARD = gnu99; 396 | GCC_NO_COMMON_BLOCKS = YES; 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 404 | MTL_ENABLE_DEBUG_INFO = NO; 405 | SDKROOT = iphoneos; 406 | SUPPORTED_PLATFORMS = iphoneos; 407 | SWIFT_COMPILATION_MODE = wholemodule; 408 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 409 | TARGETED_DEVICE_FAMILY = "1,2"; 410 | VALIDATE_PRODUCT = YES; 411 | }; 412 | name = Release; 413 | }; 414 | 97C147061CF9000F007C117D /* Debug */ = { 415 | isa = XCBuildConfiguration; 416 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 417 | buildSettings = { 418 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 419 | CLANG_ENABLE_MODULES = YES; 420 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 421 | ENABLE_BITCODE = NO; 422 | INFOPLIST_FILE = Runner/Info.plist; 423 | LD_RUNPATH_SEARCH_PATHS = ( 424 | "$(inherited)", 425 | "@executable_path/Frameworks", 426 | ); 427 | PRODUCT_BUNDLE_IDENTIFIER = com.example.rgbLintPlayground; 428 | PRODUCT_NAME = "$(TARGET_NAME)"; 429 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 430 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 431 | SWIFT_VERSION = 5.0; 432 | VERSIONING_SYSTEM = "apple-generic"; 433 | }; 434 | name = Debug; 435 | }; 436 | 97C147071CF9000F007C117D /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 439 | buildSettings = { 440 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 441 | CLANG_ENABLE_MODULES = YES; 442 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 443 | ENABLE_BITCODE = NO; 444 | INFOPLIST_FILE = Runner/Info.plist; 445 | LD_RUNPATH_SEARCH_PATHS = ( 446 | "$(inherited)", 447 | "@executable_path/Frameworks", 448 | ); 449 | PRODUCT_BUNDLE_IDENTIFIER = com.example.rgbLintPlayground; 450 | PRODUCT_NAME = "$(TARGET_NAME)"; 451 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 452 | SWIFT_VERSION = 5.0; 453 | VERSIONING_SYSTEM = "apple-generic"; 454 | }; 455 | name = Release; 456 | }; 457 | /* End XCBuildConfiguration section */ 458 | 459 | /* Begin XCConfigurationList section */ 460 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 461 | isa = XCConfigurationList; 462 | buildConfigurations = ( 463 | 97C147031CF9000F007C117D /* Debug */, 464 | 97C147041CF9000F007C117D /* Release */, 465 | 249021D3217E4FDB00AE95B9 /* Profile */, 466 | ); 467 | defaultConfigurationIsVisible = 0; 468 | defaultConfigurationName = Release; 469 | }; 470 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 471 | isa = XCConfigurationList; 472 | buildConfigurations = ( 473 | 97C147061CF9000F007C117D /* Debug */, 474 | 97C147071CF9000F007C117D /* Release */, 475 | 249021D4217E4FDB00AE95B9 /* Profile */, 476 | ); 477 | defaultConfigurationIsVisible = 0; 478 | defaultConfigurationName = Release; 479 | }; 480 | /* End XCConfigurationList section */ 481 | }; 482 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 483 | } 484 | -------------------------------------------------------------------------------- /playground/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /playground/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /playground/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /playground/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /playground/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /playground/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /playground/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /playground/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/playground/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /playground/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /playground/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /playground/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /playground/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Rgb Lint Playground 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | rgb_lint_playground 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /playground/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /playground/lib/data/enums/correct_name_enum.dart: -------------------------------------------------------------------------------- 1 | enum GenderEnum{ 2 | male, 3 | female 4 | } -------------------------------------------------------------------------------- /playground/lib/data/enums/incorrect_name_enum.dart: -------------------------------------------------------------------------------- 1 | enum Gender{ 2 | male, 3 | female 4 | } -------------------------------------------------------------------------------- /playground/lib/data/languages/id/button_lang.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | Map button = {}; 4 | 5 | -------------------------------------------------------------------------------- /playground/lib/data/network/enums/correct_enum_name_network_enum.dart: -------------------------------------------------------------------------------- 1 | enum GenderEnum{ 2 | male, 3 | female 4 | } -------------------------------------------------------------------------------- /playground/lib/data/network/enums/incorrect_enum_name_network_enum.dart: -------------------------------------------------------------------------------- 1 | enum Gender{ 2 | male, 3 | female 4 | } -------------------------------------------------------------------------------- /playground/lib/data/network/model/incorrect_model_name_network_enum.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | class Booking{} 4 | 5 | class Schedule{} -------------------------------------------------------------------------------- /playground/lib/data/network/service/incorrect_service_rule_service.dart: -------------------------------------------------------------------------------- 1 | 2 | class AccountNetwork{} -------------------------------------------------------------------------------- /playground/lib/main.dart: -------------------------------------------------------------------------------- 1 | 2 | void main() { 3 | print('hello world'); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /playground/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: playground 2 | description: A new Flutter project. 3 | # The following line prevents the package from being accidentally published to 4 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 5 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 6 | 7 | # The following defines the version and build number for your application. 8 | # A version number is three numbers separated by dots, like 1.2.43 9 | # followed by an optional build number separated by a +. 10 | # Both the version and the builder number may be overridden in flutter 11 | # build by specifying --build-name and --build-number, respectively. 12 | # In Android, build-name is used as versionName while build-number used as versionCode. 13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 15 | # Read more about iOS versioning at 16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 | # In Windows, build-name is used as the major, minor, and patch parts 18 | # of the product and file versions while build-number is used as the build suffix. 19 | version: 1.0.0+1 20 | 21 | environment: 22 | sdk: '>=2.19.0 <3.0.0' 23 | 24 | # Dependencies specify other packages that your package needs in order to work. 25 | # To automatically upgrade your package dependencies to the latest versions 26 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 27 | # dependencies can be manually updated by changing the version numbers below to 28 | # the latest version available on pub.dev. To see which dependencies have newer 29 | # versions available, run `flutter pub outdated`. 30 | dependencies: 31 | flutter: 32 | sdk: flutter 33 | cupertino_icons: ^1.0.2 34 | riverpod: 35 | retrofit: ^3.0.1+1 36 | dio: ^4.0.6 37 | json_annotation: ^4.5.0 38 | 39 | 40 | dev_dependencies: 41 | flutter_test: 42 | sdk: flutter 43 | json_serializable: ^6.2.0 44 | flutter_lints: ^2.0.0 45 | 46 | dependency_overrides: 47 | custom_lint: ^0.2.5 48 | glory_convention_lint: 49 | path: ../ 50 | 51 | # For information on the generic Dart part of this file, see the 52 | # following page: https://dart.dev/tools/pub/pubspec 53 | 54 | 55 | # The following section is specific to Flutter packages. 56 | flutter: 57 | 58 | # The following line ensures that the Material Icons font is 59 | # included with your application, so that you can use the icons in 60 | # the material Icons class. 61 | uses-material-design: true 62 | 63 | # To add assets to your application, add an assets section, like this: 64 | # assets: 65 | # - images/a_dot_burr.jpeg 66 | # - images/a_dot_ham.jpeg 67 | 68 | # An image asset can refer to one or more resolution-specific "variants", see 69 | # https://flutter.dev/assets-and-images/#resolution-aware 70 | 71 | # For details regarding adding assets from package dependencies, see 72 | # https://flutter.dev/assets-and-images/#from-packages 73 | 74 | # To add custom fonts to your application, add a fonts section here, 75 | # in this "flutter" section. Each entry in this list should have a 76 | # "family" key with the font family name, and a "fonts" key with a 77 | # list giving the asset and other descriptors for the font. For 78 | # example: 79 | # fonts: 80 | # - family: Schyler 81 | # fonts: 82 | # - asset: fonts/Schyler-Regular.ttf 83 | # - asset: fonts/Schyler-Italic.ttf 84 | # style: italic 85 | # - family: Trajan Pro 86 | # fonts: 87 | # - asset: fonts/TrajanPro.ttf 88 | # - asset: fonts/TrajanPro_Bold.ttf 89 | # weight: 700 90 | # 91 | # For details regarding fonts from package dependencies, 92 | # see https://flutter.dev/custom-fonts/#from-packages 93 | -------------------------------------------------------------------------------- /playground/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | void main() { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: glory_convention_lint 2 | description: GloryConventionLint is code judgment for Convention Lint Flutter. 3 | version: 1.0.0 4 | homepage: https://rollingglory.com/ 5 | repository: https://github.com/rollingglory/GloryConventionLint-flutter 6 | issue_tracker: https://github.com/rollingglory/GloryConventionLint-flutter/issues 7 | documentation: https://github.com/rollingglory/GloryConventionLint-flutter/blob/main/README.md 8 | 9 | 10 | environment: 11 | sdk: '>=2.18.2 <3.0.0' 12 | 13 | dependencies: 14 | analyzer: ^5.0.0 15 | analyzer_plugin: ^0.11.2 16 | collection: ^1.17.0 17 | custom_lint_builder: ^0.2.5 18 | matcher: ^0.12.13 19 | meta: ^1.8.0 20 | path: ^1.8.2 21 | 22 | dev_dependencies: 23 | custom_lint: 24 | lints: ^2.0.0 25 | 26 | -------------------------------------------------------------------------------- /resource/incorrect_service_rule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/resource/incorrect_service_rule.png -------------------------------------------------------------------------------- /resource/incorrect_service_rule_problems.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollingglory/GloryConventionLint-flutter/f6c03bf94657a4b3e83569517cc66a5422770086/resource/incorrect_service_rule_problems.png -------------------------------------------------------------------------------- /test/glory_convention_lint_test.dart: -------------------------------------------------------------------------------- 1 | void main() { 2 | 3 | } 4 | --------------------------------------------------------------------------------