Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dcm_global.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: "1.33.0"
version: "1.35.0"
8 changes: 8 additions & 0 deletions packages/netglade_analysis/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 21.0.0
- Adhere to DCM 1.34.0 and 1.35.0:
- Add avoid-complex-conditions
- Add avoid-immediately-invoked-functions
- Add avoid-assigning-notifiers
- Add use-ref-and-state-synchronously
- Update maintainability-index metric to match new config

## 20.0.1
- Remove (ignore) deprecated_member_use_from_same_package diagnostic

Expand Down
2 changes: 1 addition & 1 deletion packages/netglade_analysis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To use the lints, add as a dev dependency in your `pubspec.yaml`:

```yaml
dev_dependencies:
netglade_analysis: ^20.0.0
netglade_analysis: ^21.0.0
```

Then, add an include in `analysis_options.yaml`:
Expand Down
10 changes: 8 additions & 2 deletions packages/netglade_analysis/lib/dcm.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# version 1.32.0 - https://dcm.dev/changelog
# version 1.35.0 - https://dcm.dev/changelog
dart_code_metrics:
rules:
### Common
Expand Down Expand Up @@ -28,6 +28,7 @@ dart_code_metrics:
# - avoid-collection-mutating-methods # sometimes it's ok
- avoid-commented-out-code
- avoid-complex-arithmetic-expressions
- avoid-complex-conditions
- avoid-complex-loop-conditions
- avoid-conditions-with-boolean-literals
- avoid-constant-assert-conditions
Expand Down Expand Up @@ -76,6 +77,7 @@ dart_code_metrics:
- avoid-ignoring-return-values:
exclude:
- test/**
- avoid-immediately-invoked-functions
- avoid-implicitly-nullable-extension-types
- avoid-importing-entrypoint-exports
- avoid-inconsistent-digit-separators
Expand Down Expand Up @@ -318,6 +320,7 @@ dart_code_metrics:
- no-object-declaration
# - parameters-ordering # way too strict
- pass-correct-accepted-type
# - pass-optional-argument * OK, we just don't have global config
- pattern-fields-ordering
- prefer-abstract-final-static-class
- prefer-add-all
Expand Down Expand Up @@ -563,6 +566,7 @@ dart_code_metrics:
- prefer-sealed-bloc-state

### Riverpod
- avoid-assigning-notifiers
- avoid-calling-notifier-members-inside-build
- avoid-notifier-constructors
- avoid-nullable-async-value-pattern
Expand All @@ -573,6 +577,7 @@ dart_code_metrics:
- avoid-unnecessary-consumer-widgets
- dispose-provided-instances
- prefer-immutable-provider-arguments
- use-ref-and-state-synchronously
- use-ref-read-synchronously

### Equatable
Expand Down Expand Up @@ -625,6 +630,7 @@ dart_code_metrics:
# - provide-correct-intl-args

### Easy Localization
# - avoid-missing-tr-on-strings # we dont like this
- avoid-missing-tr

### Angular - not used
Expand Down Expand Up @@ -655,7 +661,7 @@ dart_code_metrics:
cyclomatic-complexity: 20
halstead-volume: 150
lines-of-code: 200
maintainability-index: 50
maintainability-index: 0.5
maximum-nesting-level: 5
number-of-parameters: 4
number-of-used-widgets: 20
Expand Down
2 changes: 1 addition & 1 deletion packages/netglade_analysis/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: netglade_analysis
resolution: workspace
description: Lint rules for Dart and Flutter used internally at netglade.
version: 20.0.1
version: 21.0.0
repository: https://github.com/netglade/flutter_core/tree/main/packages/netglade_analysis
issue_tracker: https://github.com/netglade/flutter_core/issues
homepage: https://github.com/netglade/flutter_core
Expand Down
2 changes: 1 addition & 1 deletion packages/netglade_flutter_utils/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ environment:
dependencies:
flutter:
sdk: flutter
netglade_analysis: ^20.0.0
netglade_analysis: ^21.0.0
netglade_flutter_utils:
path: ..

Expand Down
2 changes: 1 addition & 1 deletion packages/netglade_flutter_utils/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dev_dependencies:
flutter_test:
sdk: flutter
mocktail: ^1.0.0
netglade_analysis: ^20.0.0
netglade_analysis: ^21.0.0
test: ^1.25.8

flutter:
Expand Down
2 changes: 1 addition & 1 deletion packages/netglade_utils/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ environment:
sdk: ^3.10.0

dependencies:
netglade_analysis: ^20.0.0
netglade_analysis: ^21.0.0
netglade_utils:
path: ..
2 changes: 1 addition & 1 deletion packages/netglade_utils/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ dependencies:
mocktail: ^1.0.0

dev_dependencies:
netglade_analysis: ^20.0.0
netglade_analysis: ^21.0.0
test: ^1.25.2
Original file line number Diff line number Diff line change
@@ -1,57 +1,101 @@
// ignore_for_file: prefer-boolean-prefixes

import 'package:netglade_utils/netglade_utils.dart';
import 'package:test/test.dart';

void main() {
test('nowWithoutTime', () {
// arrange

// act
final date = DateTimeExtensions.nowWithoutTime();

// assert
expect(DateTime.now().withoutTime, equals(date));
});

<DateTime, DateTime>{
for (final MapEntry(:key, :value) in <DateTime, DateTime>{
DateTime(2022, 11, 28): DateTime(2022, 12, 2),
DateTime(2022, 11, 29): DateTime(2022, 12, 2),
DateTime(2022, 11, 30): DateTime(2022, 12, 2),
DateTime(2022, 12): DateTime(2022, 12, 2),
DateTime(2022, 12, 2): DateTime(2022, 12, 2),
DateTime(2022, 12, 3): DateTime(2022, 12, 9),
DateTime(2022, 12, 4): DateTime(2022, 12, 9),
}.forEach((key, value) {
}.entries) {
test('EndOfWorkWeek: $key should be $value', () {
expect(key.endOfWorkWeek, equals(value));
// arrange

// act
final processed = key.endOfWorkWeek;

// assert
expect(processed, equals(value));
});
});
}

<DateTime, DateTime>{
for (final MapEntry(:key, :value) in <DateTime, DateTime>{
DateTime(2022, 11, 28): DateTime(2022, 12, 4),
DateTime(2022, 11, 29): DateTime(2022, 12, 4),
DateTime(2022, 11, 30): DateTime(2022, 12, 4),
DateTime(2022, 12): DateTime(2022, 12, 4),
DateTime(2022, 12, 2): DateTime(2022, 12, 4),
DateTime(2022, 12, 3): DateTime(2022, 12, 4),
DateTime(2022, 12, 4): DateTime(2022, 12, 4),
}.forEach((key, value) {
}.entries) {
test('EndOfWeek: $key should be $value', () {
expect(key.endOfWeek, equals(value));
// arrange

// act
final processed = key.endOfWeek;

// assert
expect(processed, equals(value));
});
});
}

test('isToday', () {
// arrange
final date = DateTime.now();
expect(date.isToday, isTrue);

// act
final processed = date.isToday;

// assert
expect(processed, isTrue);
});

test('isTomorrow', () {
final date = DateTime.now().add(const Duration(days: 1));
expect(date.isTomorrow, isTrue);
// arrange
const durationToAdd = Duration(days: 1);

// act
final date = DateTime.now().add(durationToAdd);
final processed = date.isTomorrow;

// assert
expect(processed, isTrue);
});

test('withoutTime', () {
// arrange
final date = DateTime(2022, 1, 1, 4, 30, 30);
expect(date.withoutTime, equals(DateTime(2022)));

// act
final processed = date.withoutTime;

// assert
expect(processed, equals(DateTime(2022)));
});

test('withoutDate', () {
// arrange
final date = DateTime(2022, 1, 1, 4, 30, 30);
expect(date.withoutTime, equals(DateTime(2022)));

// act
final processed = date.withoutTime;

// assert
expect(processed, equals(DateTime(2022)));
});
}
Loading