Skip to content

Commit 74c5d09

Browse files
authored
Merge pull request #553 from DevKor-github/feature/issue-543-rename-moving-time-dir
Rename schedule place moving time folder
2 parents fb58f59 + bf5933b commit 74c5d09

10 files changed

Lines changed: 93 additions & 9 deletions

File tree

lib/presentation/schedule_create/components/schedule_multi_page_form.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import 'package:on_time_front/presentation/schedule_create/schedule_date_time/cu
77
import 'package:on_time_front/presentation/schedule_create/schedule_date_time/screens/schedule_date_time_form.dart';
88
import 'package:on_time_front/presentation/schedule_create/schedule_name/screens/schedule_name_form.dart';
99
import 'package:on_time_front/presentation/schedule_create/schedule_name/cubit/schedule_name_cubit.dart';
10-
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time.dart/cubit/schedule_place_moving_time_cubit.dart';
11-
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time.dart/screens/schedule_place_moving_time_form.dart';
10+
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time/cubit/schedule_place_moving_time_cubit.dart';
11+
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time/screens/schedule_place_moving_time_form.dart';
1212
import 'package:on_time_front/presentation/schedule_create/schedule_spare_and_preparing_time/cubit/schedule_form_spare_time_cubit.dart';
1313
import 'package:on_time_front/presentation/schedule_create/schedule_spare_and_preparing_time/screens/schedule_spare_and_preparing_time_form.dart';
1414
import 'package:on_time_front/presentation/shared/components/step_progress.dart';

lib/presentation/schedule_create/schedule_place_moving_time.dart/cubit/schedule_place_moving_time_cubit.dart renamed to lib/presentation/schedule_create/schedule_place_moving_time/cubit/schedule_place_moving_time_cubit.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
44
import 'package:formz/formz.dart';
55
import 'package:on_time_front/l10n/app_localizations.dart';
66
import 'package:on_time_front/presentation/schedule_create/bloc/schedule_form_bloc.dart';
7-
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time.dart/input_models/schedule_moving_time_input_model.dart';
8-
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time.dart/input_models/schedule_place_input_model.dart';
7+
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time/input_models/schedule_moving_time_input_model.dart';
8+
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time/input_models/schedule_place_input_model.dart';
99
import 'package:on_time_front/presentation/shared/constants/constants.dart';
1010

1111
part 'schedule_place_moving_time_state.dart';

lib/presentation/schedule_create/schedule_place_moving_time.dart/cubit/schedule_place_moving_time_state.dart renamed to lib/presentation/schedule_create/schedule_place_moving_time/cubit/schedule_place_moving_time_state.dart

File renamed without changes.

lib/presentation/schedule_create/schedule_place_moving_time.dart/input_models/schedule_moving_time_input_model.dart renamed to lib/presentation/schedule_create/schedule_place_moving_time/input_models/schedule_moving_time_input_model.dart

File renamed without changes.

lib/presentation/schedule_create/schedule_place_moving_time.dart/input_models/schedule_place_input_model.dart renamed to lib/presentation/schedule_create/schedule_place_moving_time/input_models/schedule_place_input_model.dart

File renamed without changes.

lib/presentation/schedule_create/schedule_place_moving_time.dart/screens/schedule_place_moving_time_form.dart renamed to lib/presentation/schedule_create/schedule_place_moving_time/screens/schedule_place_moving_time_form.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart';
22
import 'package:flutter/material.dart';
33
import 'package:flutter_bloc/flutter_bloc.dart';
44
import 'package:on_time_front/l10n/app_localizations.dart';
5-
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time.dart/cubit/schedule_place_moving_time_cubit.dart';
5+
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time/cubit/schedule_place_moving_time_cubit.dart';
66
import 'package:on_time_front/presentation/shared/components/cupertino_picker_modal.dart';
77
import 'package:on_time_front/presentation/schedule_create/components/message_bubble.dart';
88

test/presentation/schedule_create/input_models/backend_validation_input_models_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:flutter_test/flutter_test.dart';
22
import 'package:on_time_front/presentation/onboarding/preparation_time/input_models/preparation_time_input_model.dart';
33
import 'package:on_time_front/presentation/schedule_create/schedule_name/input_models/schedule_name_input_model.dart';
4-
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time.dart/input_models/schedule_moving_time_input_model.dart';
4+
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time/input_models/schedule_moving_time_input_model.dart';
55
import 'package:on_time_front/presentation/schedule_create/schedule_spare_and_preparing_time/input_models/schedule_spare_time_input_model.dart';
66

77
void main() {

test/presentation/schedule_create/schedule_place_moving_time/schedule_place_moving_time_form_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
33
import 'package:flutter_test/flutter_test.dart';
44
import 'package:on_time_front/l10n/app_localizations.dart';
55
import 'package:on_time_front/presentation/schedule_create/bloc/schedule_form_bloc.dart';
6-
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time.dart/cubit/schedule_place_moving_time_cubit.dart';
7-
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time.dart/screens/schedule_place_moving_time_form.dart';
6+
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time/cubit/schedule_place_moving_time_cubit.dart';
7+
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time/screens/schedule_place_moving_time_form.dart';
88
import 'package:on_time_front/presentation/shared/theme/theme.dart';
99

1010
void main() {

test/presentation/schedule_create/schedule_time_inputs_cubit_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:flutter_test/flutter_test.dart';
22
import 'package:on_time_front/domain/entities/preparation_entity.dart';
33
import 'package:on_time_front/domain/entities/preparation_step_entity.dart';
44
import 'package:on_time_front/presentation/schedule_create/bloc/schedule_form_bloc.dart';
5-
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time.dart/cubit/schedule_place_moving_time_cubit.dart';
5+
import 'package:on_time_front/presentation/schedule_create/schedule_place_moving_time/cubit/schedule_place_moving_time_cubit.dart';
66
import 'package:on_time_front/presentation/schedule_create/schedule_spare_and_preparing_time/cubit/schedule_form_spare_time_cubit.dart';
77

88
void main() {
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import 'dart:io';
2+
3+
import 'package:flutter_test/flutter_test.dart';
4+
5+
void main() {
6+
group('repository structure', () {
7+
test('source and test directories do not use .dart suffixes', () {
8+
final dartDirectories =
9+
_directoriesUnder(['lib', 'test'])
10+
.where(
11+
(directory) =>
12+
_lastPathSegment(directory.path).endsWith('.dart'),
13+
)
14+
.map(_relativePath)
15+
.toList()
16+
..sort();
17+
18+
expect(dartDirectories, isEmpty);
19+
});
20+
21+
test('schedule place moving time imports use the folder path', () {
22+
final obsoleteSegment =
23+
'schedule_place_moving_time'
24+
'.dart/';
25+
final offenders =
26+
_dartFilesUnder([
27+
'lib',
28+
'test',
29+
]).expand((file) => _matchingLines(file, obsoleteSegment)).toList()
30+
..sort();
31+
32+
expect(offenders, isEmpty);
33+
});
34+
});
35+
}
36+
37+
Iterable<Directory> _directoriesUnder(List<String> rootPaths) sync* {
38+
for (final rootPath in rootPaths) {
39+
final root = Directory(rootPath);
40+
if (!root.existsSync()) {
41+
continue;
42+
}
43+
44+
yield* root
45+
.listSync(recursive: true, followLinks: false)
46+
.whereType<Directory>();
47+
}
48+
}
49+
50+
Iterable<File> _dartFilesUnder(List<String> rootPaths) sync* {
51+
for (final rootPath in rootPaths) {
52+
final root = Directory(rootPath);
53+
if (!root.existsSync()) {
54+
continue;
55+
}
56+
57+
yield* root
58+
.listSync(recursive: true, followLinks: false)
59+
.whereType<File>()
60+
.where((file) => file.path.endsWith('.dart'));
61+
}
62+
}
63+
64+
Iterable<String> _matchingLines(File file, String pattern) sync* {
65+
final lines = file.readAsLinesSync();
66+
67+
for (var index = 0; index < lines.length; index += 1) {
68+
if (lines[index].contains(pattern)) {
69+
yield '${_relativePath(file)}:${index + 1}';
70+
}
71+
}
72+
}
73+
74+
String _lastPathSegment(String path) => path.split(Platform.pathSeparator).last;
75+
76+
String _relativePath(FileSystemEntity entity) {
77+
final currentPath = Directory.current.path;
78+
final entityPath = entity.path;
79+
final prefix = '$currentPath${Platform.pathSeparator}';
80+
81+
return entityPath.startsWith(prefix)
82+
? entityPath.substring(prefix.length)
83+
: entityPath;
84+
}

0 commit comments

Comments
 (0)