Revert "Enable lints library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors" (#5691)

This reverts commit 5d92a4717a7a266f485974ff5403122ef2570935.

This includes a fix for a latent bug in the version-check repo tooling command that caused it to fail when reverting a package that previously had a NEXT section, so that tests will pass.
This commit is contained in:
stuartmorgan
2022-05-10 13:05:18 -04:00
committed by GitHub
parent 5d92a4717a
commit 1a124b18d3
4 changed files with 51 additions and 15 deletions

View File

@ -39,8 +39,11 @@ enum _CurrentVersionState {
/// The version is unchanged.
unchanged,
/// The version has changed, and the transition is valid.
validChange,
/// The version has increased, and the transition is valid.
validIncrease,
/// The version has decrease, and the transition is a valid revert.
validRevert,
/// The version has changed, and the transition is invalid.
invalidChange,
@ -218,7 +221,8 @@ class VersionCheckCommand extends PackageLoopingCommand {
case _CurrentVersionState.unchanged:
versionChanged = false;
break;
case _CurrentVersionState.validChange:
case _CurrentVersionState.validIncrease:
case _CurrentVersionState.validRevert:
versionChanged = true;
break;
case _CurrentVersionState.invalidChange:
@ -232,7 +236,7 @@ class VersionCheckCommand extends PackageLoopingCommand {
}
if (!(await _validateChangelogVersion(package,
pubspec: pubspec, pubspecVersionChanged: versionChanged))) {
pubspec: pubspec, pubspecVersionState: versionState))) {
errors.add('CHANGELOG.md failed validation.');
}
@ -322,7 +326,7 @@ ${indentation}HTTP response: ${pubVersionFinderResponse.httpResponse.body}
'${getBoolArg(_againstPubFlag) ? 'on pub server' : 'at git base'}.');
logWarning(
'${indentation}If this plugin is not new, something has gone wrong.');
return _CurrentVersionState.validChange; // Assume new, thus valid.
return _CurrentVersionState.validIncrease; // Assume new, thus valid.
}
if (previousVersion == currentVersion) {
@ -340,7 +344,7 @@ ${indentation}HTTP response: ${pubVersionFinderResponse.httpResponse.body}
if (possibleVersionsFromNewVersion.containsKey(previousVersion)) {
logWarning('${indentation}New version is lower than previous version. '
'This is assumed to be a revert.');
return _CurrentVersionState.validChange;
return _CurrentVersionState.validRevert;
}
}
@ -367,7 +371,7 @@ ${indentation}HTTP response: ${pubVersionFinderResponse.httpResponse.body}
return _CurrentVersionState.invalidChange;
}
return _CurrentVersionState.validChange;
return _CurrentVersionState.validIncrease;
}
/// Checks whether or not [package]'s CHANGELOG's versioning is correct,
@ -378,7 +382,7 @@ ${indentation}HTTP response: ${pubVersionFinderResponse.httpResponse.body}
Future<bool> _validateChangelogVersion(
RepositoryPackage package, {
required Pubspec pubspec,
required bool pubspecVersionChanged,
required _CurrentVersionState pubspecVersionState,
}) async {
// This method isn't called unless `version` is non-null.
final Version fromPubspec = pubspec.version!;
@ -405,8 +409,9 @@ ${indentation}HTTP response: ${pubVersionFinderResponse.httpResponse.body}
// changes that don't warrant publishing on their own.
final bool hasNextSection = versionString == 'NEXT';
if (hasNextSection) {
// NEXT should not be present in a commit that changes the version.
if (pubspecVersionChanged) {
// NEXT should not be present in a commit that increases the version.
if (pubspecVersionState == _CurrentVersionState.validIncrease ||
pubspecVersionState == _CurrentVersionState.invalidChange) {
printError(badNextErrorMessage);
return false;
}