crawlscope 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/README.md +7 -0
- data/UPGRADE.md +84 -0
- data/docs/architecture.md +73 -0
- data/docs/link-map.md +203 -0
- data/docs/rails.md +9 -0
- data/docs/rules.md +49 -0
- data/lib/crawlscope/cli.rb +86 -5
- data/lib/crawlscope/configuration.rb +2 -1
- data/lib/crawlscope/crawl.rb +11 -79
- data/lib/crawlscope/crawling/fetcher_factory.rb +31 -0
- data/lib/crawlscope/crawling/target.rb +45 -0
- data/lib/crawlscope/crawling/target_resolver.rb +75 -0
- data/lib/crawlscope/documents/canonical.rb +22 -0
- data/lib/crawlscope/documents/robots.rb +57 -0
- data/lib/crawlscope/http.rb +37 -13
- data/lib/crawlscope/link_map/audit.rb +240 -0
- data/lib/crawlscope/link_map/extractor.rb +59 -0
- data/lib/crawlscope/link_map/graph.rb +165 -0
- data/lib/crawlscope/link_map/manifest.rb +68 -0
- data/lib/crawlscope/link_map/report.rb +217 -0
- data/lib/crawlscope/link_map/robots_policy.rb +72 -0
- data/lib/crawlscope/link_map/scope.rb +82 -0
- data/lib/crawlscope/link_map/sitemap_urls.rb +103 -0
- data/lib/crawlscope/page.rb +4 -0
- data/lib/crawlscope/rake_tasks.rb +11 -1
- data/lib/crawlscope/reporter.rb +19 -162
- data/lib/crawlscope/reporting/issue_presenter.rb +162 -0
- data/lib/crawlscope/reporting/url_formatter.rb +29 -0
- data/lib/crawlscope/rule_registry.rb +2 -2
- data/lib/crawlscope/rules/content_quality.rb +18 -0
- data/lib/crawlscope/rules/indexability.rb +9 -14
- data/lib/crawlscope/rules/links/canonical_checks.rb +102 -0
- data/lib/crawlscope/rules/links/extractor.rb +100 -0
- data/lib/crawlscope/rules/links/graph.rb +39 -0
- data/lib/crawlscope/rules/links/inbound_checks.rb +124 -0
- data/lib/crawlscope/rules/links/outgoing_checks.rb +104 -0
- data/lib/crawlscope/rules/links/resolution_check.rb +88 -0
- data/lib/crawlscope/rules/links/scope.rb +23 -0
- data/lib/crawlscope/rules/links/target_lookup.rb +38 -0
- data/lib/crawlscope/rules/links/url_checks.rb +54 -0
- data/lib/crawlscope/rules/links.rb +18 -600
- data/lib/crawlscope/rules/metadata.rb +2 -2
- data/lib/crawlscope/rules/structured_data.rb +26 -77
- data/lib/crawlscope/rules/uniqueness.rb +1 -1
- data/lib/crawlscope/run.rb +16 -0
- data/lib/crawlscope/schemas.rb +10 -2
- data/lib/crawlscope/server_timing/reporter.rb +2 -13
- data/lib/crawlscope/sitemap.rb +16 -5
- data/lib/crawlscope/structured_data/audit.rb +17 -76
- data/lib/crawlscope/structured_data/check.rb +2 -0
- data/lib/crawlscope/structured_data/document.rb +14 -1
- data/lib/crawlscope/structured_data/entry.rb +31 -0
- data/lib/crawlscope/structured_data/outcome.rb +11 -0
- data/lib/crawlscope/structured_data/report.rb +6 -14
- data/lib/crawlscope/structured_data/reporter.rb +6 -11
- data/lib/crawlscope/structured_data/validator.rb +64 -0
- data/lib/crawlscope/version.rb +1 -1
- data/lib/tasks/crawlscope_tasks.rake +6 -1
- data/test/crawlscope/cli_test.rb +21 -0
- data/test/crawlscope/content_quality_rule_test.rb +51 -0
- data/test/crawlscope/link_map_test.rb +337 -0
- data/test/crawlscope/links_rule_test.rb +16 -0
- data/test/crawlscope/rake_tasks_test.rb +10 -0
- data/test/crawlscope/reporter_test.rb +12 -0
- data/test/crawlscope/schema_registry_test.rb +22 -0
- data/test/crawlscope/structured_data_audit_test.rb +60 -0
- data/test/crawlscope/structured_data_report_test.rb +32 -0
- data/test/crawlscope/structured_data_rule_test.rb +11 -1
- data/test/crawlscope/structured_data_validator_test.rb +24 -0
- metadata +46 -1
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
require "test_helper"
|
|
4
4
|
|
|
5
5
|
class CrawlscopeStructuredDataRuleTest < Minitest::Test
|
|
6
|
+
def test_does_not_assume_host_routes_require_job_posting_markup
|
|
7
|
+
issues = Crawlscope::IssueCollection.new
|
|
8
|
+
document = page(url: "https://example.com/careers/team", body: '<script type="application/ld+json">{"@type":"WebPage","name":"Our team"}</script>')
|
|
9
|
+
|
|
10
|
+
Crawlscope::Rules::StructuredData.new.call(urls: [document.url], pages: [document], issues: issues,
|
|
11
|
+
context: {schema_registry: Crawlscope::SchemaRegistry.default})
|
|
12
|
+
|
|
13
|
+
refute_includes issues.map(&:code), :missing_job_posting
|
|
14
|
+
end
|
|
15
|
+
|
|
6
16
|
def test_reports_schema_errors_for_invalid_article_markup
|
|
7
17
|
issues = Crawlscope::IssueCollection.new
|
|
8
18
|
rule = Crawlscope::Rules::StructuredData.new
|
|
@@ -203,7 +213,7 @@ class CrawlscopeStructuredDataRuleTest < Minitest::Test
|
|
|
203
213
|
|
|
204
214
|
def test_reports_missing_job_posting_for_career_detail_pages
|
|
205
215
|
issues = Crawlscope::IssueCollection.new
|
|
206
|
-
rule = Crawlscope::Rules::StructuredData.new
|
|
216
|
+
rule = Crawlscope::Rules::StructuredData.new(job_posting_path: %r{/careers/[^/]+/?\z})
|
|
207
217
|
page = page(
|
|
208
218
|
url: "https://example.com/careers/sales-partner",
|
|
209
219
|
body: <<~HTML
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class CrawlscopeStructuredDataValidatorTest < Minitest::Test
|
|
6
|
+
def test_requires_every_type_group
|
|
7
|
+
validator = Crawlscope::StructuredData::Validator.new(schema_registry: Crawlscope::SchemaRegistry.default)
|
|
8
|
+
html = '<script type="application/ld+json">{"@type":"WebPage","name":"Benchmark"}</script>'
|
|
9
|
+
|
|
10
|
+
result = validator.call(html: html, required_types: ["WebPage", "Dataset"])
|
|
11
|
+
|
|
12
|
+
assert_equal [:structured_data_missing_required_type], result.findings.map(&:code)
|
|
13
|
+
assert_equal ["Dataset"], result.findings.first.errors.first.fetch(:expected_types)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_microdata_satisfies_type_requirements
|
|
17
|
+
validator = Crawlscope::StructuredData::Validator.new(schema_registry: Crawlscope::SchemaRegistry.default)
|
|
18
|
+
html = '<article itemscope itemtype="https://schema.org/Article"><h1 itemprop="headline">A guide</h1></article>'
|
|
19
|
+
|
|
20
|
+
result = validator.call(html: html, required_types: [["Article", "BlogPosting", "NewsArticle"]])
|
|
21
|
+
|
|
22
|
+
assert_empty result.findings
|
|
23
|
+
end
|
|
24
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: crawlscope
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paulo Fidalgo
|
|
@@ -24,6 +24,20 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '1.3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: csv
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '3.3'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '3.3'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: async
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -178,6 +192,8 @@ files:
|
|
|
178
192
|
- LICENSE.txt
|
|
179
193
|
- README.md
|
|
180
194
|
- UPGRADE.md
|
|
195
|
+
- docs/architecture.md
|
|
196
|
+
- docs/link-map.md
|
|
181
197
|
- docs/rails.md
|
|
182
198
|
- docs/rules.md
|
|
183
199
|
- docs/server-timing.md
|
|
@@ -189,24 +205,48 @@ files:
|
|
|
189
205
|
- lib/crawlscope/context.rb
|
|
190
206
|
- lib/crawlscope/crawl.rb
|
|
191
207
|
- lib/crawlscope/crawler.rb
|
|
208
|
+
- lib/crawlscope/crawling/fetcher_factory.rb
|
|
209
|
+
- lib/crawlscope/crawling/target.rb
|
|
210
|
+
- lib/crawlscope/crawling/target_resolver.rb
|
|
192
211
|
- lib/crawlscope/document_text.rb
|
|
212
|
+
- lib/crawlscope/documents/canonical.rb
|
|
213
|
+
- lib/crawlscope/documents/robots.rb
|
|
193
214
|
- lib/crawlscope/fetch_executor.rb
|
|
194
215
|
- lib/crawlscope/fetch_executor/async.rb
|
|
195
216
|
- lib/crawlscope/fetch_executor/threaded.rb
|
|
196
217
|
- lib/crawlscope/http.rb
|
|
197
218
|
- lib/crawlscope/issue.rb
|
|
198
219
|
- lib/crawlscope/issue_collection.rb
|
|
220
|
+
- lib/crawlscope/link_map/audit.rb
|
|
221
|
+
- lib/crawlscope/link_map/extractor.rb
|
|
222
|
+
- lib/crawlscope/link_map/graph.rb
|
|
223
|
+
- lib/crawlscope/link_map/manifest.rb
|
|
224
|
+
- lib/crawlscope/link_map/report.rb
|
|
225
|
+
- lib/crawlscope/link_map/robots_policy.rb
|
|
226
|
+
- lib/crawlscope/link_map/scope.rb
|
|
227
|
+
- lib/crawlscope/link_map/sitemap_urls.rb
|
|
199
228
|
- lib/crawlscope/page.rb
|
|
200
229
|
- lib/crawlscope/rails.rb
|
|
201
230
|
- lib/crawlscope/railtie.rb
|
|
202
231
|
- lib/crawlscope/rake_tasks.rb
|
|
203
232
|
- lib/crawlscope/reporter.rb
|
|
233
|
+
- lib/crawlscope/reporting/issue_presenter.rb
|
|
234
|
+
- lib/crawlscope/reporting/url_formatter.rb
|
|
204
235
|
- lib/crawlscope/request_headers.rb
|
|
205
236
|
- lib/crawlscope/result.rb
|
|
206
237
|
- lib/crawlscope/rule_registry.rb
|
|
207
238
|
- lib/crawlscope/rules/content_quality.rb
|
|
208
239
|
- lib/crawlscope/rules/indexability.rb
|
|
209
240
|
- lib/crawlscope/rules/links.rb
|
|
241
|
+
- lib/crawlscope/rules/links/canonical_checks.rb
|
|
242
|
+
- lib/crawlscope/rules/links/extractor.rb
|
|
243
|
+
- lib/crawlscope/rules/links/graph.rb
|
|
244
|
+
- lib/crawlscope/rules/links/inbound_checks.rb
|
|
245
|
+
- lib/crawlscope/rules/links/outgoing_checks.rb
|
|
246
|
+
- lib/crawlscope/rules/links/resolution_check.rb
|
|
247
|
+
- lib/crawlscope/rules/links/scope.rb
|
|
248
|
+
- lib/crawlscope/rules/links/target_lookup.rb
|
|
249
|
+
- lib/crawlscope/rules/links/url_checks.rb
|
|
210
250
|
- lib/crawlscope/rules/metadata.rb
|
|
211
251
|
- lib/crawlscope/rules/structured_data.rb
|
|
212
252
|
- lib/crawlscope/rules/uniqueness.rb
|
|
@@ -220,9 +260,12 @@ files:
|
|
|
220
260
|
- lib/crawlscope/structured_data/audit.rb
|
|
221
261
|
- lib/crawlscope/structured_data/check.rb
|
|
222
262
|
- lib/crawlscope/structured_data/document.rb
|
|
263
|
+
- lib/crawlscope/structured_data/entry.rb
|
|
223
264
|
- lib/crawlscope/structured_data/error_formatter.rb
|
|
265
|
+
- lib/crawlscope/structured_data/outcome.rb
|
|
224
266
|
- lib/crawlscope/structured_data/report.rb
|
|
225
267
|
- lib/crawlscope/structured_data/reporter.rb
|
|
268
|
+
- lib/crawlscope/structured_data/validator.rb
|
|
226
269
|
- lib/crawlscope/structured_data/writer.rb
|
|
227
270
|
- lib/crawlscope/tasks.rb
|
|
228
271
|
- lib/crawlscope/url.rb
|
|
@@ -240,6 +283,7 @@ files:
|
|
|
240
283
|
- test/crawlscope/http_test.rb
|
|
241
284
|
- test/crawlscope/indexability_rule_test.rb
|
|
242
285
|
- test/crawlscope/install_generator_test.rb
|
|
286
|
+
- test/crawlscope/link_map_test.rb
|
|
243
287
|
- test/crawlscope/links_rule_test.rb
|
|
244
288
|
- test/crawlscope/loader_test.rb
|
|
245
289
|
- test/crawlscope/metadata_rule_test.rb
|
|
@@ -258,6 +302,7 @@ files:
|
|
|
258
302
|
- test/crawlscope/structured_data_report_test.rb
|
|
259
303
|
- test/crawlscope/structured_data_reporter_test.rb
|
|
260
304
|
- test/crawlscope/structured_data_rule_test.rb
|
|
305
|
+
- test/crawlscope/structured_data_validator_test.rb
|
|
261
306
|
- test/crawlscope/structured_data_writer_test.rb
|
|
262
307
|
- test/crawlscope/uniqueness_rule_test.rb
|
|
263
308
|
- test/crawlscope/url_test.rb
|