@@ -109,7 +109,7 @@ class VersionCheckCommand extends PluginCommand {
109109 @override
110110 final String description =
111111 'Checks if the versions of the plugins have been incremented per pub specification.\n '
112- 'Also checks if the version in CHANGELOG matches the version in pubspec.\n\n '
112+ 'Also checks if the latest version in CHANGELOG matches the version in pubspec.\n\n '
113113 'This command requires "pub" and "flutter" to be in your path.' ;
114114
115115 @override
@@ -147,7 +147,7 @@ class VersionCheckCommand extends PluginCommand {
147147 final String error = '$pubspecPath incorrectly updated version.\n '
148148 'HEAD: $headVersion , master: $masterVersion .\n '
149149 'Allowed versions: $allowedNextVersions ' ;
150- PrintErrorAndExit (errorMessage: error);
150+ printErrorAndExit (errorMessage: error);
151151 }
152152
153153 bool isPlatformInterface = pubspec.name.endsWith ("_platform_interface" );
@@ -156,7 +156,7 @@ class VersionCheckCommand extends PluginCommand {
156156 NextVersionType .BREAKING_MAJOR ) {
157157 final String error = '$pubspecPath breaking change detected.\n '
158158 'Breaking changes to platform interfaces are strongly discouraged.\n ' ;
159- PrintErrorAndExit (errorMessage: error);
159+ printErrorAndExit (errorMessage: error);
160160 }
161161 } on io.ProcessException {
162162 print ('Unable to find pubspec in master for $pubspecPath .'
@@ -181,7 +181,7 @@ class VersionCheckCommand extends PluginCommand {
181181 final Pubspec pubspec = _tryParsePubspec (plugin);
182182 if (pubspec == null ) {
183183 final String error = 'Cannot parse version from pubspec.yaml' ;
184- PrintErrorAndExit (errorMessage: error);
184+ printErrorAndExit (errorMessage: error);
185185 }
186186 final Version fromPubspec = pubspec.version;
187187
@@ -191,10 +191,7 @@ class VersionCheckCommand extends PluginCommand {
191191 String firstLineWithText;
192192 final Iterator iterator = lines.iterator;
193193 while (iterator.moveNext ()) {
194- final String currentStriptEmptySpaces =
195- (iterator.current as String ).replaceAll (' ' , '' );
196- if (currentStriptEmptySpaces != null &&
197- currentStriptEmptySpaces.isNotEmpty) {
194+ if ((iterator.current as String ).trim ().isNotEmpty) {
198195 firstLineWithText = iterator.current;
199196 break ;
200197 }
@@ -204,8 +201,8 @@ class VersionCheckCommand extends PluginCommand {
204201 Version fromChangeLog = Version .parse (versionString);
205202 if (fromChangeLog == null ) {
206203 final String error =
207- 'Cannot find version on the first line of CHANGELOG.md' ;
208- PrintErrorAndExit (errorMessage: error);
204+ 'Cannot find version on the first line of ${ plugin . path }/ CHANGELOG.md' ;
205+ printErrorAndExit (errorMessage: error);
209206 }
210207
211208 if (fromPubspec != fromChangeLog) {
@@ -214,7 +211,7 @@ versions for $packageName in CHANGELOG.md and pubspec.yaml do not match.
214211The version in pubspec.yaml is $fromPubspec .
215212The first version listed in CHANGELOG.md is $fromChangeLog .
216213''' ;
217- PrintErrorAndExit (errorMessage: error);
214+ printErrorAndExit (errorMessage: error);
218215 }
219216 print ('${packageName } passed version check' );
220217 }
@@ -227,13 +224,13 @@ The first version listed in CHANGELOG.md is $fromChangeLog.
227224 if (pubspec == null ) {
228225 final String error =
229226 'Failed to parse `pubspec.yaml` at ${pubspecFile .path }' ;
230- PrintErrorAndExit (errorMessage: error);
227+ printErrorAndExit (errorMessage: error);
231228 }
232229 return pubspec;
233230 } on Exception catch (exception) {
234231 final String error =
235232 'Failed to parse `pubspec.yaml` at ${pubspecFile .path }: $exception }' ;
236- PrintErrorAndExit (errorMessage: error);
233+ printErrorAndExit (errorMessage: error);
237234 }
238235 return null ;
239236 }
0 commit comments