Skip to content

Commit 040cf3a

Browse files
authored
Deprecated -> Discontinued (#1006)
* Rename deprecated to discontinued. * Remove packages from search index when deprecated flag is set.
1 parent 3dd5916 commit 040cf3a

30 files changed

+72
-96
lines changed

app/bin/tools/deprecate.dart renamed to app/bin/tools/discontinue.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ Future _read(String packageName) async {
5454
if (p == null) {
5555
throw new Exception('Package $packageName does not exist.');
5656
}
57-
final isDeprecated = p.isDeprecated ?? false;
58-
final label = isDeprecated ? 'deprecated' : '-';
57+
final isDiscontinued = p.isDiscontinued ?? false;
58+
final label = isDiscontinued ? 'discontinued' : '-';
5959
print('Package $packageName: $label');
6060
}
6161

@@ -67,10 +67,10 @@ Future _set(String packageName, bool value) {
6767
if (p == null) {
6868
throw new Exception('Package $packageName does not exist.');
6969
}
70-
p.isDeprecated = value;
70+
p.isDiscontinued = value;
7171
tx.queueMutations(inserts: [p]);
7272
await tx.commit();
73-
print('Package $packageName: isDeprecated=$value');
73+
print('Package $packageName: isDiscontinued=$value');
7474
await new AnalyzerClient()
7575
.triggerAnalysis(packageName, p.latestVersion, new Set());
7676
});

app/lib/analyzer/backend.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ class AnalysisBackend {
347347
exists: true,
348348
publishDate: pv.created,
349349
isLatestStable: p.latestVersion == version,
350-
isDeprecated: p.isDeprecated ?? false,
350+
isDiscontinued: p.isDiscontinued ?? false,
351351
);
352352
}
353353
}
@@ -356,13 +356,13 @@ class PackageStatus {
356356
final bool exists;
357357
final DateTime publishDate;
358358
final bool isLatestStable;
359-
final bool isDeprecated;
359+
final bool isDiscontinued;
360360

361361
PackageStatus({
362362
this.exists,
363363
this.publishDate,
364364
this.isLatestStable: false,
365-
this.isDeprecated: false,
365+
this.isDiscontinued: false,
366366
});
367367
}
368368

app/lib/analyzer/model_properties.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class AnalysisStatusProperty extends StringProperty {
2525
return 'failure';
2626
case AnalysisStatus.success:
2727
return 'success';
28-
case AnalysisStatus.deprecated:
29-
return 'deprecated';
28+
case AnalysisStatus.discontinued:
29+
return 'discontinued';
3030
case AnalysisStatus.outdated:
3131
return 'outdated';
3232
default:
@@ -47,8 +47,8 @@ class AnalysisStatusProperty extends StringProperty {
4747
return AnalysisStatus.failure;
4848
case 'success':
4949
return AnalysisStatus.success;
50-
case 'deprecated':
51-
return AnalysisStatus.deprecated;
50+
case 'discontinued':
51+
return AnalysisStatus.discontinued;
5252
case 'outdated':
5353
return AnalysisStatus.outdated;
5454
default:

app/lib/analyzer/pana_runner.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class PanaRunner implements TaskRunner {
5656
final Analysis analysis =
5757
new Analysis.init(task.package, task.version, timestamp);
5858

59-
if (packageStatus.isDeprecated) {
60-
_logger.info('Package is deprecated: $task.');
61-
analysis.analysisStatus = AnalysisStatus.deprecated;
59+
if (packageStatus.isDiscontinued) {
60+
_logger.info('Package is discontinued: $task.');
61+
analysis.analysisStatus = AnalysisStatus.discontinued;
6262
analysis.maintenanceScore = 0.0;
6363
final backendStatus = await _analysisBackend.storeAnalysis(analysis);
6464
return backendStatus.wasRace;

app/lib/frontend/models.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Package extends db.ExpandoModel {
5050
List<String> uploaderEmails;
5151

5252
@db.BoolProperty()
53-
bool isDeprecated;
53+
bool isDiscontinued;
5454

5555
// Convenience Fields:
5656

app/lib/frontend/templates.dart

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ class TemplateService {
192192
case AnalysisStatus.failure:
193193
statusText = 'tool failures';
194194
break;
195-
case AnalysisStatus.deprecated:
196-
statusText = 'skipped (deprecated)';
195+
case AnalysisStatus.discontinued:
196+
statusText = 'skipped (discontinued)';
197197
break;
198198
case AnalysisStatus.outdated:
199199
statusText = 'skipped (outdated)';
@@ -226,10 +226,10 @@ class TemplateService {
226226

227227
final Map<String, dynamic> data = {
228228
'package': package,
229-
'show_deprecated': analysisStatus == AnalysisStatus.deprecated,
229+
'show_discontinued': analysisStatus == AnalysisStatus.discontinued,
230230
'show_outdated': analysisStatus == AnalysisStatus.outdated,
231231
'show_analysis': analysisStatus != AnalysisStatus.outdated &&
232-
analysisStatus != AnalysisStatus.deprecated,
232+
analysisStatus != AnalysisStatus.discontinued,
233233
'date_completed': analysis.timestamp == null
234234
? null
235235
: shortDateFormat.format(analysis.timestamp),
@@ -683,12 +683,11 @@ class TemplateService {
683683
'text': '[awaiting]',
684684
'title': 'Analysis should be ready soon.',
685685
});
686-
} else if (status == AnalysisStatus.deprecated) {
686+
} else if (status == AnalysisStatus.discontinued) {
687687
tags.add({
688-
// TODO: replace with a new deprecated style
689-
'status': 'unidentified',
690-
'text': '[deprecated]',
691-
'title': 'Package was deprecated.',
688+
'status': 'discontinued',
689+
'text': '[discontinued]',
690+
'title': 'Package was discontinued.',
692691
});
693692
} else if (status == AnalysisStatus.outdated) {
694693
tags.add({
@@ -787,8 +786,8 @@ String _getAuthorsHtml(List<String> authors) {
787786

788787
String _renderScoreBox(AnalysisStatus status, double overallScore,
789788
{bool isNewPackage, String package}) {
790-
final skippedAnalysis =
791-
status == AnalysisStatus.outdated || status == AnalysisStatus.deprecated;
789+
final skippedAnalysis = status == AnalysisStatus.outdated ||
790+
status == AnalysisStatus.discontinued;
792791
final score = skippedAnalysis ? null : overallScore;
793792
final String formattedScore = _formatScore(score);
794793
final String scoreClass = _classifyScore(score);

app/lib/search/backend.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class SearchBackend {
9191
created: p.created,
9292
updated: pv.created,
9393
readme: compactReadme(pv.readmeContent),
94-
isDeprecated: p.isDeprecated ?? false,
94+
isDiscontinued: p.isDiscontinued ?? false,
9595
health: analysisView.health,
9696
popularity: popularity,
9797
maintenance: analysisView.maintenanceScore,

app/lib/search/index_simple.dart

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class SimplePackageIndex implements PackageIndex {
6868
Future addPackage(PackageDocument document) async {
6969
final PackageDocument doc = document.intern(_internPool.intern);
7070
await removePackage(doc.package);
71+
if (document.isDiscontinued == true) return; // isDiscontinued may be null
7172
_packages[doc.package] = doc;
7273
_nameIndex.add(doc.package, doc.package);
7374
_descrIndex.add(doc.package, doc.description);
@@ -195,16 +196,13 @@ class SimplePackageIndex implements PackageIndex {
195196
results = _rankWithComparator(packages, _compareUpdated);
196197
break;
197198
case SearchOrder.popularity:
198-
results = _rankWithValues(getPopularityScore(packages),
199-
deprecatedRank: _DeprecatedRank.keep);
199+
results = _rankWithValues(getPopularityScore(packages));
200200
break;
201201
case SearchOrder.health:
202-
results = _rankWithValues(getHealthScore(packages),
203-
deprecatedRank: _DeprecatedRank.remove);
202+
results = _rankWithValues(getHealthScore(packages));
204203
break;
205204
case SearchOrder.maintenance:
206-
results = _rankWithValues(getMaintenanceScore(packages),
207-
deprecatedRank: _DeprecatedRank.remove);
205+
results = _rankWithValues(getMaintenanceScore(packages));
208206
break;
209207
}
210208

@@ -324,25 +322,10 @@ class SimplePackageIndex implements PackageIndex {
324322
return null;
325323
}
326324

327-
List<PackageScore> _rankWithValues(Map<String, double> values,
328-
{_DeprecatedRank deprecatedRank: _DeprecatedRank.back}) {
325+
List<PackageScore> _rankWithValues(Map<String, double> values) {
329326
final List<PackageScore> list = values.keys
330327
.map((package) {
331-
final doc = _packages[package];
332-
double score = values[package];
333-
// isDeprecated may be null
334-
if (doc.isDeprecated == true) {
335-
switch (deprecatedRank) {
336-
case _DeprecatedRank.keep:
337-
// keeps score
338-
break;
339-
case _DeprecatedRank.back:
340-
score -= 100.0;
341-
break;
342-
case _DeprecatedRank.remove:
343-
return null;
344-
}
345-
}
328+
final score = values[package];
346329
return new PackageScore(package: package, score: score);
347330
})
348331
.where((ps) => ps != null)
@@ -635,14 +618,3 @@ Set<String> _tokenize(String originalText, int minLength) {
635618
}
636619

637620
bool _isLower(String c) => c.toLowerCase() == c;
638-
639-
enum _DeprecatedRank {
640-
/// Keep original score.
641-
keep,
642-
643-
/// Remove deprecated package from the results.
644-
remove,
645-
646-
/// Move deprecated package to the back.
647-
back,
648-
}

app/lib/shared/analyzer_service.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ enum AnalysisStatus {
4040
/// One or more tools failed to produce the expected output.
4141
failure,
4242

43-
/// Analysis was not started, because package is considered deprecated.
44-
deprecated,
43+
/// Analysis was not started, because package is considered discontinued.
44+
discontinued,
4545

4646
/// Analysis was not started, because package is considered old and has a
4747
/// newer stable release.
@@ -59,7 +59,7 @@ int analysisStatusLevel(AnalysisStatus status) {
5959
return 0;
6060
case AnalysisStatus.failure:
6161
return 1;
62-
case AnalysisStatus.deprecated:
62+
case AnalysisStatus.discontinued:
6363
case AnalysisStatus.outdated:
6464
case AnalysisStatus.success:
6565
return 2;

app/lib/shared/search_service.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class PackageDocument extends Object with _$PackageDocumentSerializerMixin {
4747
final DateTime created;
4848
final DateTime updated;
4949
final String readme;
50-
final bool isDeprecated;
50+
final bool isDiscontinued;
5151

5252
final List<String> platforms;
5353

@@ -69,7 +69,7 @@ class PackageDocument extends Object with _$PackageDocumentSerializerMixin {
6969
this.created,
7070
this.updated,
7171
this.readme,
72-
this.isDeprecated,
72+
this.isDiscontinued,
7373
this.platforms,
7474
this.health,
7575
this.popularity,
@@ -91,7 +91,7 @@ class PackageDocument extends Object with _$PackageDocumentSerializerMixin {
9191
created: created,
9292
updated: updated,
9393
readme: readme,
94-
isDeprecated: isDeprecated,
94+
isDiscontinued: isDiscontinued,
9595
platforms: platforms?.map(internFn)?.toList(),
9696
health: health,
9797
popularity: popularity,

app/lib/shared/search_service.g.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PackageDocument _$PackageDocumentFromJson(Map<String, dynamic> json) =>
2525
? null
2626
: DateTime.parse(json['updated'] as String),
2727
readme: json['readme'] as String,
28-
isDeprecated: json['isDeprecated'] as bool,
28+
isDiscontinued: json['isDiscontinued'] as bool,
2929
platforms:
3030
(json['platforms'] as List)?.map((e) => e as String)?.toList(),
3131
health: (json['health'] as num)?.toDouble(),
@@ -47,7 +47,7 @@ abstract class _$PackageDocumentSerializerMixin {
4747
DateTime get created;
4848
DateTime get updated;
4949
String get readme;
50-
bool get isDeprecated;
50+
bool get isDiscontinued;
5151
List<String> get platforms;
5252
double get health;
5353
double get popularity;
@@ -63,7 +63,7 @@ abstract class _$PackageDocumentSerializerMixin {
6363
'created': created?.toIso8601String(),
6464
'updated': updated?.toIso8601String(),
6565
'readme': readme,
66-
'isDeprecated': isDeprecated,
66+
'isDiscontinued': isDiscontinued,
6767
'platforms': platforms,
6868
'health': health,
6969
'popularity': popularity,

app/test/frontend/golden/authorized_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<meta property="og:description" content="Pub is a package manager for the Dart programming language." />
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
20-
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
20+
<link href="/static/css/style.css?hash=07j2kluf48ctep1e1u8kf6bvn4qdkkfo" rel="stylesheet" type="text/css" />
2121
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

app/test/frontend/golden/error_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<meta property="og:description" content="Pub is a package manager for the Dart programming language." />
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
20-
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
20+
<link href="/static/css/style.css?hash=07j2kluf48ctep1e1u8kf6bvn4qdkkfo" rel="stylesheet" type="text/css" />
2121
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

app/test/frontend/golden/flutter_landing_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<meta property="og:description" content="Pub is a package manager for the Dart programming language." />
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
20-
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
20+
<link href="/static/css/style.css?hash=07j2kluf48ctep1e1u8kf6bvn4qdkkfo" rel="stylesheet" type="text/css" />
2121
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

app/test/frontend/golden/index_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<meta property="og:description" content="Pub is a package manager for the Dart programming language." />
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
20-
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
20+
<link href="/static/css/style.css?hash=07j2kluf48ctep1e1u8kf6bvn4qdkkfo" rel="stylesheet" type="text/css" />
2121
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

app/test/frontend/golden/pkg_index_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<meta property="og:description" content="Pub is a package manager for the Dart programming language." />
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
20-
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
20+
<link href="/static/css/style.css?hash=07j2kluf48ctep1e1u8kf6bvn4qdkkfo" rel="stylesheet" type="text/css" />
2121
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

app/test/frontend/golden/pkg_show_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<meta property="og:description" content="foobar_pkg 0.1.1 Dart package - my package description" />
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
20-
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
20+
<link href="/static/css/style.css?hash=07j2kluf48ctep1e1u8kf6bvn4qdkkfo" rel="stylesheet" type="text/css" />
2121
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

app/test/frontend/golden/pkg_show_page_deprecated.html renamed to app/test/frontend/golden/pkg_show_page_discontinued.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<meta property="og:description" content="foobar_pkg 0.1.1 Dart package - my package description" />
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
20-
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
20+
<link href="/static/css/style.css?hash=07j2kluf48ctep1e1u8kf6bvn4qdkkfo" rel="stylesheet" type="text/css" />
2121
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -78,7 +78,7 @@ <h2 class="title">foobar_pkg 0.1.1</h2>
7878
<div class="metadata">
7979
Published <span>Jan 1, 2014</span>
8080
<!-- &bull; Downloads: X -->
81-
<div class="tags"> <span class="package-tag unidentified" title="Package was deprecated.">[deprecated]</span>
81+
<div class="tags"> <span class="package-tag discontinued" title="Package was discontinued.">[discontinued]</span>
8282
</div>
8383
</div>
8484
</div>
@@ -180,7 +180,7 @@ <h2>Analysis</h2>
180180
More details: <a href="/help#scoring">scoring</a>.
181181
</div>
182182

183-
<p>This package is not analyzed, because it is deprecated.</p>
183+
<p>This package is not analyzed, because it is discontinued.</p>
184184

185185
</section>
186186
</div>

app/test/frontend/golden/pkg_show_page_flutter_plugin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<meta property="og:description" content="foobar_pkg 0.1.1 Flutter and Dart package - my package description" />
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
20-
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
20+
<link href="/static/css/style.css?hash=07j2kluf48ctep1e1u8kf6bvn4qdkkfo" rel="stylesheet" type="text/css" />
2121
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

app/test/frontend/golden/pkg_show_page_outdated.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<meta property="og:description" content="foobar_pkg 0.1.1 Dart package - my package description" />
1818
<link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom" />
1919
<link href="/static/highlight/github.css" rel="stylesheet" />
20-
<link href="/static/css/style.css?hash=e04t8j4c9t71h5ha7p4pdkgq33og2ucf" rel="stylesheet" type="text/css" />
20+
<link href="/static/css/style.css?hash=07j2kluf48ctep1e1u8kf6bvn4qdkkfo" rel="stylesheet" type="text/css" />
2121
<script src="/static/js/script.dart.js?hash=dpnjl27j3qcb445c0v5519t0j84ob0km" defer></script>
2222
<script>
2323
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

0 commit comments

Comments
 (0)