├── .Rbuildignore ├── .github ├── .gitignore ├── CODE_OF_CONDUCT.md └── workflows │ ├── R-CMD-check.yaml │ ├── pkgdown.yaml │ ├── pr-commands.yaml │ └── test-coverage.yaml ├── .gitignore ├── .vscode ├── extensions.json └── settings.json ├── DESCRIPTION ├── LICENSE.md ├── MAINTENANCE.md ├── NAMESPACE ├── NEWS.md ├── R ├── rmd.R ├── url_check.R ├── url_update.R ├── urlchecker-package.R ├── utils.R └── zzz.R ├── README.md ├── _pkgdown.yml ├── air.toml ├── codecov.yml ├── cran-comments.md ├── inst └── tools │ ├── README.md │ ├── urltools.R │ └── utils.R ├── man ├── url_check.Rd ├── url_update.Rd └── urlchecker-package.Rd └── urlchecker.Rproj /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^LICENSE\.md$ 2 | ^script\.R$ 3 | ^\.github$ 4 | ^cran-comments\.md$ 5 | ^codecov\.yml$ 6 | ^MAINTENANCE\.md$ 7 | ^CRAN-RELEASE$ 8 | ^_pkgdown\.yml$ 9 | ^docs$ 10 | ^pkgdown$ 11 | ^.*\.Rproj$ 12 | ^\.Rproj\.user$ 13 | ^[\.]?air\.toml$ 14 | ^\.vscode$ 15 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, caste, color, religion, or sexual 10 | identity and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the overall 26 | community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or advances of 31 | any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email address, 35 | without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at codeofconduct@posit.co. 63 | All complaints will be reviewed and investigated promptly and fairly. 64 | 65 | All community leaders are obligated to respect the privacy and security of the 66 | reporter of any incident. 67 | 68 | ## Enforcement Guidelines 69 | 70 | Community leaders will follow these Community Impact Guidelines in determining 71 | the consequences for any action they deem in violation of this Code of Conduct: 72 | 73 | ### 1. Correction 74 | 75 | **Community Impact**: Use of inappropriate language or other behavior deemed 76 | unprofessional or unwelcome in the community. 77 | 78 | **Consequence**: A private, written warning from community leaders, providing 79 | clarity around the nature of the violation and an explanation of why the 80 | behavior was inappropriate. A public apology may be requested. 81 | 82 | ### 2. Warning 83 | 84 | **Community Impact**: A violation through a single incident or series of 85 | actions. 86 | 87 | **Consequence**: A warning with consequences for continued behavior. No 88 | interaction with the people involved, including unsolicited interaction with 89 | those enforcing the Code of Conduct, for a specified period of time. This 90 | includes avoiding interactions in community spaces as well as external channels 91 | like social media. Violating these terms may lead to a temporary or permanent 92 | ban. 93 | 94 | ### 3. Temporary Ban 95 | 96 | **Community Impact**: A serious violation of community standards, including 97 | sustained inappropriate behavior. 98 | 99 | **Consequence**: A temporary ban from any sort of interaction or public 100 | communication with the community for a specified period of time. No public or 101 | private interaction with the people involved, including unsolicited interaction 102 | with those enforcing the Code of Conduct, is allowed during this period. 103 | Violating these terms may lead to a permanent ban. 104 | 105 | ### 4. Permanent Ban 106 | 107 | **Community Impact**: Demonstrating a pattern of violation of community 108 | standards, including sustained inappropriate behavior, harassment of an 109 | individual, or aggression toward or disparagement of classes of individuals. 110 | 111 | **Consequence**: A permanent ban from any sort of public interaction within the 112 | community. 113 | 114 | ## Attribution 115 | 116 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 117 | version 2.1, available at 118 | . 119 | 120 | Community Impact Guidelines were inspired by 121 | [Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion]. 122 | 123 | For answers to common questions about this code of conduct, see the FAQ at 124 | . Translations are available at . 125 | 126 | [homepage]: https://www.contributor-covenant.org 127 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | # 4 | # NOTE: This workflow is overkill for most R packages and 5 | # check-standard.yaml is likely a better choice. 6 | # usethis::use_github_action("check-standard") will install it. 7 | on: 8 | push: 9 | branches: [main, master] 10 | pull_request: 11 | 12 | name: R-CMD-check.yaml 13 | 14 | permissions: read-all 15 | 16 | jobs: 17 | R-CMD-check: 18 | runs-on: ${{ matrix.config.os }} 19 | 20 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | config: 26 | - {os: macos-latest, r: 'release'} 27 | 28 | - {os: windows-latest, r: 'release'} 29 | # use 4.0 or 4.1 to check with rtools40's older compiler 30 | - {os: windows-latest, r: 'oldrel-4'} 31 | 32 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 33 | - {os: ubuntu-latest, r: 'release'} 34 | - {os: ubuntu-latest, r: 'oldrel-1'} 35 | - {os: ubuntu-latest, r: 'oldrel-2'} 36 | - {os: ubuntu-latest, r: 'oldrel-3'} 37 | - {os: ubuntu-latest, r: 'oldrel-4'} 38 | 39 | env: 40 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 41 | R_KEEP_PKG_SOURCE: yes 42 | 43 | steps: 44 | - uses: actions/checkout@v4 45 | 46 | - uses: r-lib/actions/setup-pandoc@v2 47 | 48 | - uses: r-lib/actions/setup-r@v2 49 | with: 50 | r-version: ${{ matrix.config.r }} 51 | http-user-agent: ${{ matrix.config.http-user-agent }} 52 | use-public-rspm: true 53 | 54 | - uses: r-lib/actions/setup-r-dependencies@v2 55 | with: 56 | extra-packages: any::rcmdcheck 57 | needs: check 58 | 59 | - uses: r-lib/actions/check-r-package@v2 60 | with: 61 | upload-snapshots: true 62 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' 63 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | release: 8 | types: [published] 9 | workflow_dispatch: 10 | 11 | name: pkgdown.yaml 12 | 13 | permissions: read-all 14 | 15 | jobs: 16 | pkgdown: 17 | runs-on: ubuntu-latest 18 | # Only restrict concurrency for non-PR jobs 19 | concurrency: 20 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} 21 | env: 22 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 23 | permissions: 24 | contents: write 25 | steps: 26 | - uses: actions/checkout@v4 27 | 28 | - uses: r-lib/actions/setup-pandoc@v2 29 | 30 | - uses: r-lib/actions/setup-r@v2 31 | with: 32 | use-public-rspm: true 33 | 34 | - uses: r-lib/actions/setup-r-dependencies@v2 35 | with: 36 | extra-packages: any::pkgdown, local::. 37 | needs: website 38 | 39 | - name: Build site 40 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) 41 | shell: Rscript {0} 42 | 43 | - name: Deploy to GitHub pages 🚀 44 | if: github.event_name != 'pull_request' 45 | uses: JamesIves/github-pages-deploy-action@v4.5.0 46 | with: 47 | clean: false 48 | branch: gh-pages 49 | folder: docs 50 | -------------------------------------------------------------------------------- /.github/workflows/pr-commands.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | issue_comment: 5 | types: [created] 6 | 7 | name: pr-commands.yaml 8 | 9 | permissions: read-all 10 | 11 | jobs: 12 | document: 13 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }} 14 | name: document 15 | runs-on: ubuntu-latest 16 | env: 17 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 18 | permissions: 19 | contents: write 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - uses: r-lib/actions/pr-fetch@v2 24 | with: 25 | repo-token: ${{ secrets.GITHUB_TOKEN }} 26 | 27 | - uses: r-lib/actions/setup-r@v2 28 | with: 29 | use-public-rspm: true 30 | 31 | - uses: r-lib/actions/setup-r-dependencies@v2 32 | with: 33 | extra-packages: any::roxygen2 34 | needs: pr-document 35 | 36 | - name: Document 37 | run: roxygen2::roxygenise() 38 | shell: Rscript {0} 39 | 40 | - name: commit 41 | run: | 42 | git config --local user.name "$GITHUB_ACTOR" 43 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 44 | git add man/\* NAMESPACE 45 | git commit -m 'Document' 46 | 47 | - uses: r-lib/actions/pr-push@v2 48 | with: 49 | repo-token: ${{ secrets.GITHUB_TOKEN }} 50 | 51 | style: 52 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} 53 | name: style 54 | runs-on: ubuntu-latest 55 | env: 56 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 57 | permissions: 58 | contents: write 59 | steps: 60 | - uses: actions/checkout@v4 61 | 62 | - uses: r-lib/actions/pr-fetch@v2 63 | with: 64 | repo-token: ${{ secrets.GITHUB_TOKEN }} 65 | 66 | - uses: r-lib/actions/setup-r@v2 67 | 68 | - name: Install dependencies 69 | run: install.packages("styler") 70 | shell: Rscript {0} 71 | 72 | - name: Style 73 | run: styler::style_pkg() 74 | shell: Rscript {0} 75 | 76 | - name: commit 77 | run: | 78 | git config --local user.name "$GITHUB_ACTOR" 79 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 80 | git add \*.R 81 | git commit -m 'Style' 82 | 83 | - uses: r-lib/actions/pr-push@v2 84 | with: 85 | repo-token: ${{ secrets.GITHUB_TOKEN }} 86 | -------------------------------------------------------------------------------- /.github/workflows/test-coverage.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | 8 | name: test-coverage.yaml 9 | 10 | permissions: read-all 11 | 12 | jobs: 13 | test-coverage: 14 | runs-on: ubuntu-latest 15 | env: 16 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | 21 | - uses: r-lib/actions/setup-r@v2 22 | with: 23 | use-public-rspm: true 24 | 25 | - uses: r-lib/actions/setup-r-dependencies@v2 26 | with: 27 | extra-packages: any::covr, any::xml2 28 | needs: coverage 29 | 30 | - name: Test coverage 31 | run: | 32 | cov <- covr::package_coverage( 33 | quiet = FALSE, 34 | clean = FALSE, 35 | install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") 36 | ) 37 | print(cov) 38 | covr::to_cobertura(cov) 39 | shell: Rscript {0} 40 | 41 | - uses: codecov/codecov-action@v5 42 | with: 43 | # Fail if error if not on PR, or if on PR and token is given 44 | fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} 45 | files: ./cobertura.xml 46 | plugins: noop 47 | disable_search: true 48 | token: ${{ secrets.CODECOV_TOKEN }} 49 | 50 | - name: Show testthat output 51 | if: always() 52 | run: | 53 | ## -------------------------------------------------------------------- 54 | find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true 55 | shell: bash 56 | 57 | - name: Upload test results 58 | if: failure() 59 | uses: actions/upload-artifact@v4 60 | with: 61 | name: coverage-test-failures 62 | path: ${{ runner.temp }}/package 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rhistory 2 | .RData 3 | .Rproj.user 4 | script.R 5 | docs 6 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "Posit.air-vscode" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[r]": { 3 | "editor.formatOnSave": true, 4 | "editor.defaultFormatter": "Posit.air-vscode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: urlchecker 2 | Title: Run CRAN URL Checks from Older R Versions 3 | Version: 1.0.1.9000 4 | Authors@R: c( 5 | person("R Core team", role = "aut", 6 | comment = "The code in urltools.R adapted from the tools package"), 7 | person("Jim", "Hester", role = "aut", 8 | comment = c(ORCID = "0000-0002-2739-7082")), 9 | person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")), 10 | person("Posit Software, PBC", role = c("cph", "fnd"), 11 | comment = c(ROR = "03wc8by49")) 12 | ) 13 | Description: Provide the URL checking tools available in R 4.1+ as a 14 | package for earlier versions of R. Also uses concurrent requests so 15 | can be much faster than the serial versions. 16 | License: GPL-3 17 | URL: https://github.com/r-lib/urlchecker, https://urlchecker.r-lib.org/ 18 | BugReports: https://github.com/r-lib/urlchecker/issues 19 | Depends: 20 | R (>= 4.1) 21 | Imports: 22 | cli, 23 | curl, 24 | tools, 25 | xml2 26 | Suggests: 27 | covr 28 | Config/Needs/website: tidyverse/tidytemplate 29 | Config/usethis/last-upkeep: 2025-05-07 30 | Encoding: UTF-8 31 | Roxygen: list(markdown = TRUE) 32 | RoxygenNote: 7.2.3 33 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU General Public License 2 | ========================== 3 | 4 | _Version 3, 29 June 2007_ 5 | _Copyright © 2007 Free Software Foundation, Inc. <>_ 6 | 7 | Everyone is permitted to copy and distribute verbatim copies of this license 8 | document, but changing it is not allowed. 9 | 10 | ## Preamble 11 | 12 | The GNU General Public License is a free, copyleft license for software and other 13 | kinds of works. 14 | 15 | The licenses for most software and other practical works are designed to take away 16 | your freedom to share and change the works. By contrast, the GNU General Public 17 | License is intended to guarantee your freedom to share and change all versions of a 18 | program--to make sure it remains free software for all its users. We, the Free 19 | Software Foundation, use the GNU General Public License for most of our software; it 20 | applies also to any other work released this way by its authors. You can apply it to 21 | your programs, too. 22 | 23 | When we speak of free software, we are referring to freedom, not price. Our General 24 | Public Licenses are designed to make sure that you have the freedom to distribute 25 | copies of free software (and charge for them if you wish), that you receive source 26 | code or can get it if you want it, that you can change the software or use pieces of 27 | it in new free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you these rights or 30 | asking you to surrender the rights. Therefore, you have certain responsibilities if 31 | you distribute copies of the software, or if you modify it: responsibilities to 32 | respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether gratis or for a fee, 35 | you must pass on to the recipients the same freedoms that you received. You must make 36 | sure that they, too, receive or can get the source code. And you must show them these 37 | terms so they know their rights. 38 | 39 | Developers that use the GNU GPL protect your rights with two steps: **(1)** assert 40 | copyright on the software, and **(2)** offer you this License giving you legal permission 41 | to copy, distribute and/or modify it. 42 | 43 | For the developers' and authors' protection, the GPL clearly explains that there is 44 | no warranty for this free software. For both users' and authors' sake, the GPL 45 | requires that modified versions be marked as changed, so that their problems will not 46 | be attributed erroneously to authors of previous versions. 47 | 48 | Some devices are designed to deny users access to install or run modified versions of 49 | the software inside them, although the manufacturer can do so. This is fundamentally 50 | incompatible with the aim of protecting users' freedom to change the software. The 51 | systematic pattern of such abuse occurs in the area of products for individuals to 52 | use, which is precisely where it is most unacceptable. Therefore, we have designed 53 | this version of the GPL to prohibit the practice for those products. If such problems 54 | arise substantially in other domains, we stand ready to extend this provision to 55 | those domains in future versions of the GPL, as needed to protect the freedom of 56 | users. 57 | 58 | Finally, every program is threatened constantly by software patents. States should 59 | not allow patents to restrict development and use of software on general-purpose 60 | computers, but in those that do, we wish to avoid the special danger that patents 61 | applied to a free program could make it effectively proprietary. To prevent this, the 62 | GPL assures that patents cannot be used to render the program non-free. 63 | 64 | The precise terms and conditions for copying, distribution and modification follow. 65 | 66 | ## TERMS AND CONDITIONS 67 | 68 | ### 0. Definitions 69 | 70 | “This License” refers to version 3 of the GNU General Public License. 71 | 72 | “Copyright” also means copyright-like laws that apply to other kinds of 73 | works, such as semiconductor masks. 74 | 75 | “The Program” refers to any copyrightable work licensed under this 76 | License. Each licensee is addressed as “you”. “Licensees” and 77 | “recipients” may be individuals or organizations. 78 | 79 | To “modify” a work means to copy from or adapt all or part of the work in 80 | a fashion requiring copyright permission, other than the making of an exact copy. The 81 | resulting work is called a “modified version” of the earlier work or a 82 | work “based on” the earlier work. 83 | 84 | A “covered work” means either the unmodified Program or a work based on 85 | the Program. 86 | 87 | To “propagate” a work means to do anything with it that, without 88 | permission, would make you directly or secondarily liable for infringement under 89 | applicable copyright law, except executing it on a computer or modifying a private 90 | copy. Propagation includes copying, distribution (with or without modification), 91 | making available to the public, and in some countries other activities as well. 92 | 93 | To “convey” a work means any kind of propagation that enables other 94 | parties to make or receive copies. Mere interaction with a user through a computer 95 | network, with no transfer of a copy, is not conveying. 96 | 97 | An interactive user interface displays “Appropriate Legal Notices” to the 98 | extent that it includes a convenient and prominently visible feature that **(1)** 99 | displays an appropriate copyright notice, and **(2)** tells the user that there is no 100 | warranty for the work (except to the extent that warranties are provided), that 101 | licensees may convey the work under this License, and how to view a copy of this 102 | License. If the interface presents a list of user commands or options, such as a 103 | menu, a prominent item in the list meets this criterion. 104 | 105 | ### 1. Source Code 106 | 107 | The “source code” for a work means the preferred form of the work for 108 | making modifications to it. “Object code” means any non-source form of a 109 | work. 110 | 111 | A “Standard Interface” means an interface that either is an official 112 | standard defined by a recognized standards body, or, in the case of interfaces 113 | specified for a particular programming language, one that is widely used among 114 | developers working in that language. 115 | 116 | The “System Libraries” of an executable work include anything, other than 117 | the work as a whole, that **(a)** is included in the normal form of packaging a Major 118 | Component, but which is not part of that Major Component, and **(b)** serves only to 119 | enable use of the work with that Major Component, or to implement a Standard 120 | Interface for which an implementation is available to the public in source code form. 121 | A “Major Component”, in this context, means a major essential component 122 | (kernel, window system, and so on) of the specific operating system (if any) on which 123 | the executable work runs, or a compiler used to produce the work, or an object code 124 | interpreter used to run it. 125 | 126 | The “Corresponding Source” for a work in object code form means all the 127 | source code needed to generate, install, and (for an executable work) run the object 128 | code and to modify the work, including scripts to control those activities. However, 129 | it does not include the work's System Libraries, or general-purpose tools or 130 | generally available free programs which are used unmodified in performing those 131 | activities but which are not part of the work. For example, Corresponding Source 132 | includes interface definition files associated with source files for the work, and 133 | the source code for shared libraries and dynamically linked subprograms that the work 134 | is specifically designed to require, such as by intimate data communication or 135 | control flow between those subprograms and other parts of the work. 136 | 137 | The Corresponding Source need not include anything that users can regenerate 138 | automatically from other parts of the Corresponding Source. 139 | 140 | The Corresponding Source for a work in source code form is that same work. 141 | 142 | ### 2. Basic Permissions 143 | 144 | All rights granted under this License are granted for the term of copyright on the 145 | Program, and are irrevocable provided the stated conditions are met. This License 146 | explicitly affirms your unlimited permission to run the unmodified Program. The 147 | output from running a covered work is covered by this License only if the output, 148 | given its content, constitutes a covered work. This License acknowledges your rights 149 | of fair use or other equivalent, as provided by copyright law. 150 | 151 | You may make, run and propagate covered works that you do not convey, without 152 | conditions so long as your license otherwise remains in force. You may convey covered 153 | works to others for the sole purpose of having them make modifications exclusively 154 | for you, or provide you with facilities for running those works, provided that you 155 | comply with the terms of this License in conveying all material for which you do not 156 | control copyright. Those thus making or running the covered works for you must do so 157 | exclusively on your behalf, under your direction and control, on terms that prohibit 158 | them from making any copies of your copyrighted material outside their relationship 159 | with you. 160 | 161 | Conveying under any other circumstances is permitted solely under the conditions 162 | stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 163 | 164 | ### 3. Protecting Users' Legal Rights From Anti-Circumvention Law 165 | 166 | No covered work shall be deemed part of an effective technological measure under any 167 | applicable law fulfilling obligations under article 11 of the WIPO copyright treaty 168 | adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention 169 | of such measures. 170 | 171 | When you convey a covered work, you waive any legal power to forbid circumvention of 172 | technological measures to the extent such circumvention is effected by exercising 173 | rights under this License with respect to the covered work, and you disclaim any 174 | intention to limit operation or modification of the work as a means of enforcing, 175 | against the work's users, your or third parties' legal rights to forbid circumvention 176 | of technological measures. 177 | 178 | ### 4. Conveying Verbatim Copies 179 | 180 | You may convey verbatim copies of the Program's source code as you receive it, in any 181 | medium, provided that you conspicuously and appropriately publish on each copy an 182 | appropriate copyright notice; keep intact all notices stating that this License and 183 | any non-permissive terms added in accord with section 7 apply to the code; keep 184 | intact all notices of the absence of any warranty; and give all recipients a copy of 185 | this License along with the Program. 186 | 187 | You may charge any price or no price for each copy that you convey, and you may offer 188 | support or warranty protection for a fee. 189 | 190 | ### 5. Conveying Modified Source Versions 191 | 192 | You may convey a work based on the Program, or the modifications to produce it from 193 | the Program, in the form of source code under the terms of section 4, provided that 194 | you also meet all of these conditions: 195 | 196 | * **a)** The work must carry prominent notices stating that you modified it, and giving a 197 | relevant date. 198 | * **b)** The work must carry prominent notices stating that it is released under this 199 | License and any conditions added under section 7. This requirement modifies the 200 | requirement in section 4 to “keep intact all notices”. 201 | * **c)** You must license the entire work, as a whole, under this License to anyone who 202 | comes into possession of a copy. This License will therefore apply, along with any 203 | applicable section 7 additional terms, to the whole of the work, and all its parts, 204 | regardless of how they are packaged. This License gives no permission to license the 205 | work in any other way, but it does not invalidate such permission if you have 206 | separately received it. 207 | * **d)** If the work has interactive user interfaces, each must display Appropriate Legal 208 | Notices; however, if the Program has interactive interfaces that do not display 209 | Appropriate Legal Notices, your work need not make them do so. 210 | 211 | A compilation of a covered work with other separate and independent works, which are 212 | not by their nature extensions of the covered work, and which are not combined with 213 | it such as to form a larger program, in or on a volume of a storage or distribution 214 | medium, is called an “aggregate” if the compilation and its resulting 215 | copyright are not used to limit the access or legal rights of the compilation's users 216 | beyond what the individual works permit. Inclusion of a covered work in an aggregate 217 | does not cause this License to apply to the other parts of the aggregate. 218 | 219 | ### 6. Conveying Non-Source Forms 220 | 221 | You may convey a covered work in object code form under the terms of sections 4 and 222 | 5, provided that you also convey the machine-readable Corresponding Source under the 223 | terms of this License, in one of these ways: 224 | 225 | * **a)** Convey the object code in, or embodied in, a physical product (including a 226 | physical distribution medium), accompanied by the Corresponding Source fixed on a 227 | durable physical medium customarily used for software interchange. 228 | * **b)** Convey the object code in, or embodied in, a physical product (including a 229 | physical distribution medium), accompanied by a written offer, valid for at least 230 | three years and valid for as long as you offer spare parts or customer support for 231 | that product model, to give anyone who possesses the object code either **(1)** a copy of 232 | the Corresponding Source for all the software in the product that is covered by this 233 | License, on a durable physical medium customarily used for software interchange, for 234 | a price no more than your reasonable cost of physically performing this conveying of 235 | source, or **(2)** access to copy the Corresponding Source from a network server at no 236 | charge. 237 | * **c)** Convey individual copies of the object code with a copy of the written offer to 238 | provide the Corresponding Source. This alternative is allowed only occasionally and 239 | noncommercially, and only if you received the object code with such an offer, in 240 | accord with subsection 6b. 241 | * **d)** Convey the object code by offering access from a designated place (gratis or for 242 | a charge), and offer equivalent access to the Corresponding Source in the same way 243 | through the same place at no further charge. You need not require recipients to copy 244 | the Corresponding Source along with the object code. If the place to copy the object 245 | code is a network server, the Corresponding Source may be on a different server 246 | (operated by you or a third party) that supports equivalent copying facilities, 247 | provided you maintain clear directions next to the object code saying where to find 248 | the Corresponding Source. Regardless of what server hosts the Corresponding Source, 249 | you remain obligated to ensure that it is available for as long as needed to satisfy 250 | these requirements. 251 | * **e)** Convey the object code using peer-to-peer transmission, provided you inform 252 | other peers where the object code and Corresponding Source of the work are being 253 | offered to the general public at no charge under subsection 6d. 254 | 255 | A separable portion of the object code, whose source code is excluded from the 256 | Corresponding Source as a System Library, need not be included in conveying the 257 | object code work. 258 | 259 | A “User Product” is either **(1)** a “consumer product”, which 260 | means any tangible personal property which is normally used for personal, family, or 261 | household purposes, or **(2)** anything designed or sold for incorporation into a 262 | dwelling. In determining whether a product is a consumer product, doubtful cases 263 | shall be resolved in favor of coverage. For a particular product received by a 264 | particular user, “normally used” refers to a typical or common use of 265 | that class of product, regardless of the status of the particular user or of the way 266 | in which the particular user actually uses, or expects or is expected to use, the 267 | product. A product is a consumer product regardless of whether the product has 268 | substantial commercial, industrial or non-consumer uses, unless such uses represent 269 | the only significant mode of use of the product. 270 | 271 | “Installation Information” for a User Product means any methods, 272 | procedures, authorization keys, or other information required to install and execute 273 | modified versions of a covered work in that User Product from a modified version of 274 | its Corresponding Source. The information must suffice to ensure that the continued 275 | functioning of the modified object code is in no case prevented or interfered with 276 | solely because modification has been made. 277 | 278 | If you convey an object code work under this section in, or with, or specifically for 279 | use in, a User Product, and the conveying occurs as part of a transaction in which 280 | the right of possession and use of the User Product is transferred to the recipient 281 | in perpetuity or for a fixed term (regardless of how the transaction is 282 | characterized), the Corresponding Source conveyed under this section must be 283 | accompanied by the Installation Information. But this requirement does not apply if 284 | neither you nor any third party retains the ability to install modified object code 285 | on the User Product (for example, the work has been installed in ROM). 286 | 287 | The requirement to provide Installation Information does not include a requirement to 288 | continue to provide support service, warranty, or updates for a work that has been 289 | modified or installed by the recipient, or for the User Product in which it has been 290 | modified or installed. Access to a network may be denied when the modification itself 291 | materially and adversely affects the operation of the network or violates the rules 292 | and protocols for communication across the network. 293 | 294 | Corresponding Source conveyed, and Installation Information provided, in accord with 295 | this section must be in a format that is publicly documented (and with an 296 | implementation available to the public in source code form), and must require no 297 | special password or key for unpacking, reading or copying. 298 | 299 | ### 7. Additional Terms 300 | 301 | “Additional permissions” are terms that supplement the terms of this 302 | License by making exceptions from one or more of its conditions. Additional 303 | permissions that are applicable to the entire Program shall be treated as though they 304 | were included in this License, to the extent that they are valid under applicable 305 | law. If additional permissions apply only to part of the Program, that part may be 306 | used separately under those permissions, but the entire Program remains governed by 307 | this License without regard to the additional permissions. 308 | 309 | When you convey a copy of a covered work, you may at your option remove any 310 | additional permissions from that copy, or from any part of it. (Additional 311 | permissions may be written to require their own removal in certain cases when you 312 | modify the work.) You may place additional permissions on material, added by you to a 313 | covered work, for which you have or can give appropriate copyright permission. 314 | 315 | Notwithstanding any other provision of this License, for material you add to a 316 | covered work, you may (if authorized by the copyright holders of that material) 317 | supplement the terms of this License with terms: 318 | 319 | * **a)** Disclaiming warranty or limiting liability differently from the terms of 320 | sections 15 and 16 of this License; or 321 | * **b)** Requiring preservation of specified reasonable legal notices or author 322 | attributions in that material or in the Appropriate Legal Notices displayed by works 323 | containing it; or 324 | * **c)** Prohibiting misrepresentation of the origin of that material, or requiring that 325 | modified versions of such material be marked in reasonable ways as different from the 326 | original version; or 327 | * **d)** Limiting the use for publicity purposes of names of licensors or authors of the 328 | material; or 329 | * **e)** Declining to grant rights under trademark law for use of some trade names, 330 | trademarks, or service marks; or 331 | * **f)** Requiring indemnification of licensors and authors of that material by anyone 332 | who conveys the material (or modified versions of it) with contractual assumptions of 333 | liability to the recipient, for any liability that these contractual assumptions 334 | directly impose on those licensors and authors. 335 | 336 | All other non-permissive additional terms are considered “further 337 | restrictions” within the meaning of section 10. If the Program as you received 338 | it, or any part of it, contains a notice stating that it is governed by this License 339 | along with a term that is a further restriction, you may remove that term. If a 340 | license document contains a further restriction but permits relicensing or conveying 341 | under this License, you may add to a covered work material governed by the terms of 342 | that license document, provided that the further restriction does not survive such 343 | relicensing or conveying. 344 | 345 | If you add terms to a covered work in accord with this section, you must place, in 346 | the relevant source files, a statement of the additional terms that apply to those 347 | files, or a notice indicating where to find the applicable terms. 348 | 349 | Additional terms, permissive or non-permissive, may be stated in the form of a 350 | separately written license, or stated as exceptions; the above requirements apply 351 | either way. 352 | 353 | ### 8. Termination 354 | 355 | You may not propagate or modify a covered work except as expressly provided under 356 | this License. Any attempt otherwise to propagate or modify it is void, and will 357 | automatically terminate your rights under this License (including any patent licenses 358 | granted under the third paragraph of section 11). 359 | 360 | However, if you cease all violation of this License, then your license from a 361 | particular copyright holder is reinstated **(a)** provisionally, unless and until the 362 | copyright holder explicitly and finally terminates your license, and **(b)** permanently, 363 | if the copyright holder fails to notify you of the violation by some reasonable means 364 | prior to 60 days after the cessation. 365 | 366 | Moreover, your license from a particular copyright holder is reinstated permanently 367 | if the copyright holder notifies you of the violation by some reasonable means, this 368 | is the first time you have received notice of violation of this License (for any 369 | work) from that copyright holder, and you cure the violation prior to 30 days after 370 | your receipt of the notice. 371 | 372 | Termination of your rights under this section does not terminate the licenses of 373 | parties who have received copies or rights from you under this License. If your 374 | rights have been terminated and not permanently reinstated, you do not qualify to 375 | receive new licenses for the same material under section 10. 376 | 377 | ### 9. Acceptance Not Required for Having Copies 378 | 379 | You are not required to accept this License in order to receive or run a copy of the 380 | Program. Ancillary propagation of a covered work occurring solely as a consequence of 381 | using peer-to-peer transmission to receive a copy likewise does not require 382 | acceptance. However, nothing other than this License grants you permission to 383 | propagate or modify any covered work. These actions infringe copyright if you do not 384 | accept this License. Therefore, by modifying or propagating a covered work, you 385 | indicate your acceptance of this License to do so. 386 | 387 | ### 10. Automatic Licensing of Downstream Recipients 388 | 389 | Each time you convey a covered work, the recipient automatically receives a license 390 | from the original licensors, to run, modify and propagate that work, subject to this 391 | License. You are not responsible for enforcing compliance by third parties with this 392 | License. 393 | 394 | An “entity transaction” is a transaction transferring control of an 395 | organization, or substantially all assets of one, or subdividing an organization, or 396 | merging organizations. If propagation of a covered work results from an entity 397 | transaction, each party to that transaction who receives a copy of the work also 398 | receives whatever licenses to the work the party's predecessor in interest had or 399 | could give under the previous paragraph, plus a right to possession of the 400 | Corresponding Source of the work from the predecessor in interest, if the predecessor 401 | has it or can get it with reasonable efforts. 402 | 403 | You may not impose any further restrictions on the exercise of the rights granted or 404 | affirmed under this License. For example, you may not impose a license fee, royalty, 405 | or other charge for exercise of rights granted under this License, and you may not 406 | initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging 407 | that any patent claim is infringed by making, using, selling, offering for sale, or 408 | importing the Program or any portion of it. 409 | 410 | ### 11. Patents 411 | 412 | A “contributor” is a copyright holder who authorizes use under this 413 | License of the Program or a work on which the Program is based. The work thus 414 | licensed is called the contributor's “contributor version”. 415 | 416 | A contributor's “essential patent claims” are all patent claims owned or 417 | controlled by the contributor, whether already acquired or hereafter acquired, that 418 | would be infringed by some manner, permitted by this License, of making, using, or 419 | selling its contributor version, but do not include claims that would be infringed 420 | only as a consequence of further modification of the contributor version. For 421 | purposes of this definition, “control” includes the right to grant patent 422 | sublicenses in a manner consistent with the requirements of this License. 423 | 424 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license 425 | under the contributor's essential patent claims, to make, use, sell, offer for sale, 426 | import and otherwise run, modify and propagate the contents of its contributor 427 | version. 428 | 429 | In the following three paragraphs, a “patent license” is any express 430 | agreement or commitment, however denominated, not to enforce a patent (such as an 431 | express permission to practice a patent or covenant not to sue for patent 432 | infringement). To “grant” such a patent license to a party means to make 433 | such an agreement or commitment not to enforce a patent against the party. 434 | 435 | If you convey a covered work, knowingly relying on a patent license, and the 436 | Corresponding Source of the work is not available for anyone to copy, free of charge 437 | and under the terms of this License, through a publicly available network server or 438 | other readily accessible means, then you must either **(1)** cause the Corresponding 439 | Source to be so available, or **(2)** arrange to deprive yourself of the benefit of the 440 | patent license for this particular work, or **(3)** arrange, in a manner consistent with 441 | the requirements of this License, to extend the patent license to downstream 442 | recipients. “Knowingly relying” means you have actual knowledge that, but 443 | for the patent license, your conveying the covered work in a country, or your 444 | recipient's use of the covered work in a country, would infringe one or more 445 | identifiable patents in that country that you have reason to believe are valid. 446 | 447 | If, pursuant to or in connection with a single transaction or arrangement, you 448 | convey, or propagate by procuring conveyance of, a covered work, and grant a patent 449 | license to some of the parties receiving the covered work authorizing them to use, 450 | propagate, modify or convey a specific copy of the covered work, then the patent 451 | license you grant is automatically extended to all recipients of the covered work and 452 | works based on it. 453 | 454 | A patent license is “discriminatory” if it does not include within the 455 | scope of its coverage, prohibits the exercise of, or is conditioned on the 456 | non-exercise of one or more of the rights that are specifically granted under this 457 | License. You may not convey a covered work if you are a party to an arrangement with 458 | a third party that is in the business of distributing software, under which you make 459 | payment to the third party based on the extent of your activity of conveying the 460 | work, and under which the third party grants, to any of the parties who would receive 461 | the covered work from you, a discriminatory patent license **(a)** in connection with 462 | copies of the covered work conveyed by you (or copies made from those copies), or **(b)** 463 | primarily for and in connection with specific products or compilations that contain 464 | the covered work, unless you entered into that arrangement, or that patent license 465 | was granted, prior to 28 March 2007. 466 | 467 | Nothing in this License shall be construed as excluding or limiting any implied 468 | license or other defenses to infringement that may otherwise be available to you 469 | under applicable patent law. 470 | 471 | ### 12. No Surrender of Others' Freedom 472 | 473 | If conditions are imposed on you (whether by court order, agreement or otherwise) 474 | that contradict the conditions of this License, they do not excuse you from the 475 | conditions of this License. If you cannot convey a covered work so as to satisfy 476 | simultaneously your obligations under this License and any other pertinent 477 | obligations, then as a consequence you may not convey it at all. For example, if you 478 | agree to terms that obligate you to collect a royalty for further conveying from 479 | those to whom you convey the Program, the only way you could satisfy both those terms 480 | and this License would be to refrain entirely from conveying the Program. 481 | 482 | ### 13. Use with the GNU Affero General Public License 483 | 484 | Notwithstanding any other provision of this License, you have permission to link or 485 | combine any covered work with a work licensed under version 3 of the GNU Affero 486 | General Public License into a single combined work, and to convey the resulting work. 487 | The terms of this License will continue to apply to the part which is the covered 488 | work, but the special requirements of the GNU Affero General Public License, section 489 | 13, concerning interaction through a network will apply to the combination as such. 490 | 491 | ### 14. Revised Versions of this License 492 | 493 | The Free Software Foundation may publish revised and/or new versions of the GNU 494 | General Public License from time to time. Such new versions will be similar in spirit 495 | to the present version, but may differ in detail to address new problems or concerns. 496 | 497 | Each version is given a distinguishing version number. If the Program specifies that 498 | a certain numbered version of the GNU General Public License “or any later 499 | version” applies to it, you have the option of following the terms and 500 | conditions either of that numbered version or of any later version published by the 501 | Free Software Foundation. If the Program does not specify a version number of the GNU 502 | General Public License, you may choose any version ever published by the Free 503 | Software Foundation. 504 | 505 | If the Program specifies that a proxy can decide which future versions of the GNU 506 | General Public License can be used, that proxy's public statement of acceptance of a 507 | version permanently authorizes you to choose that version for the Program. 508 | 509 | Later license versions may give you additional or different permissions. However, no 510 | additional obligations are imposed on any author or copyright holder as a result of 511 | your choosing to follow a later version. 512 | 513 | ### 15. Disclaimer of Warranty 514 | 515 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 516 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 517 | PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER 518 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 519 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE 520 | QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE 521 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 522 | 523 | ### 16. Limitation of Liability 524 | 525 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY 526 | COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS 527 | PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 528 | INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 529 | PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE 530 | OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE 531 | WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 532 | POSSIBILITY OF SUCH DAMAGES. 533 | 534 | ### 17. Interpretation of Sections 15 and 16 535 | 536 | If the disclaimer of warranty and limitation of liability provided above cannot be 537 | given local legal effect according to their terms, reviewing courts shall apply local 538 | law that most closely approximates an absolute waiver of all civil liability in 539 | connection with the Program, unless a warranty or assumption of liability accompanies 540 | a copy of the Program in return for a fee. 541 | 542 | _END OF TERMS AND CONDITIONS_ 543 | 544 | ## How to Apply These Terms to Your New Programs 545 | 546 | If you develop a new program, and you want it to be of the greatest possible use to 547 | the public, the best way to achieve this is to make it free software which everyone 548 | can redistribute and change under these terms. 549 | 550 | To do so, attach the following notices to the program. It is safest to attach them 551 | to the start of each source file to most effectively state the exclusion of warranty; 552 | and each file should have at least the “copyright” line and a pointer to 553 | where the full notice is found. 554 | 555 | 556 | Copyright (C) 2020 Jim Hester 557 | 558 | This program is free software: you can redistribute it and/or modify 559 | it under the terms of the GNU General Public License as published by 560 | the Free Software Foundation, either version 3 of the License, or 561 | (at your option) any later version. 562 | 563 | This program is distributed in the hope that it will be useful, 564 | but WITHOUT ANY WARRANTY; without even the implied warranty of 565 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 566 | GNU General Public License for more details. 567 | 568 | You should have received a copy of the GNU General Public License 569 | along with this program. If not, see . 570 | 571 | Also add information on how to contact you by electronic and paper mail. 572 | 573 | If the program does terminal interaction, make it output a short notice like this 574 | when it starts in an interactive mode: 575 | 576 | urlchecker Copyright (C) 2020 Jim Hester 577 | This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. 578 | This is free software, and you are welcome to redistribute it 579 | under certain conditions; type 'show c' for details. 580 | 581 | The hypothetical commands `show w` and `show c` should show the appropriate parts of 582 | the General Public License. Of course, your program's commands might be different; 583 | for a GUI interface, you would use an “about box”. 584 | 585 | You should also get your employer (if you work as a programmer) or school, if any, to 586 | sign a “copyright disclaimer” for the program, if necessary. For more 587 | information on this, and how to apply and follow the GNU GPL, see 588 | <>. 589 | 590 | The GNU General Public License does not permit incorporating your program into 591 | proprietary programs. If your program is a subroutine library, you may consider it 592 | more useful to permit linking proprietary applications with the library. If this is 593 | what you want to do, use the GNU Lesser General Public License instead of this 594 | License. But first, please read 595 | <>. 596 | -------------------------------------------------------------------------------- /MAINTENANCE.md: -------------------------------------------------------------------------------- 1 | ## Current state 2 | 3 | Generally urlchecker is stable. 4 | The one ongoing thing that needs to be done periodically is to update the code in inst/tools/urltools.R to include the latest code in R (e.g. svn cat -r 80050 https://svn.r-project.org/R/trunk/src/library/tools/R/urltools.R > urltools.R). 5 | If the code updates call new functions not defined in urltools.R you may have to backport their definitions, you can put them in `utils.R` 6 | 7 | ## Known outstanding issues 8 | 9 | It might be worth someone tracking down https://github.com/r-lib/urlchecker/issues/15 and seeing if we can tweak our code to handle this case. 10 | 11 | ## Future directions 12 | 13 | Handle .bib URLs (https://github.com/r-lib/urlchecker/issues/13) 14 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(print,urlchecker_db) 4 | export(url_check) 5 | export(url_update) 6 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # urlchecker (development version) 2 | 3 | * Handle URL fragments in redirects (#9). 4 | 5 | # urlchecker 1.0.1 6 | 7 | * Gábor Csárdi is now the maintainer. 8 | 9 | # urlchecker 1.0.0 10 | 11 | * Added a `NEWS.md` file to track changes to the package. 12 | -------------------------------------------------------------------------------- /R/rmd.R: -------------------------------------------------------------------------------- 1 | url_db_from_package_rmd_vignettes <- function(dir) { 2 | urls <- path <- character() 3 | rfiles <- Filter(file.exists, tools::pkgVignettes(dir = dir)$docs) 4 | for (rfile in rfiles) { 5 | if (!is.na(rfile) && nzchar(Sys.which("pandoc"))) { 6 | rpath <- asNamespace("tools")$.file_path_relative_to_dir(rfile, dir) 7 | tfile <- tempfile(fileext = ".html") 8 | on.exit(unlink(tfile), add = TRUE) 9 | out <- .pandoc_md_for_CRAN2(rfile, tfile) 10 | if (!out$status) { 11 | rurls <- tools$.get_urls_from_HTML_file(tfile) 12 | urls <- c(urls, rurls) 13 | path <- c(path, rep.int(rpath, length(rurls))) 14 | } 15 | } 16 | } 17 | tools$url_db(urls, path) 18 | } 19 | 20 | # adapted from https://github.com/wch/r-source/blob/58d223cf3eaa50ff8cfc2caf591d67350e549e4a/src/library/tools/R/utils.R#L1847-L1857 21 | # Adding the autolink_bare_uris extension 22 | .pandoc_md_for_CRAN2 <- function(ifile, ofile) { 23 | asNamespace("tools")$.system_with_capture( 24 | "pandoc", 25 | paste( 26 | shQuote(normalizePath(ifile)), 27 | "-s", 28 | "--mathjax", 29 | "--email-obfuscation=references", 30 | "-f", 31 | "markdown+autolink_bare_uris", 32 | "-o", 33 | shQuote(ofile) 34 | ) 35 | ) 36 | } 37 | -------------------------------------------------------------------------------- /R/url_check.R: -------------------------------------------------------------------------------- 1 | #' Check urls in a package 2 | #' 3 | #' Runs the `url_db_from_package_source` function in the tools package along 4 | #' with a function to check URLs in un-rendered Rmarkdown vignettes. 5 | #' 6 | #' @param path Path to the package 7 | #' @param db A url database 8 | #' @param parallel If `TRUE`, check the URLs in parallel 9 | #' @param pool A multi handle created by [curl::new_pool()]. If `NULL` use a global pool. 10 | #' @param progress Whether to show the progress bar for parallel checks 11 | #' @return A `url_checker_db` object (invisibly). This is a `check_url_db` object 12 | #' with an added class with a custom print method. 13 | #' @examples 14 | #' \dontrun{ 15 | #' url_check("my_pkg") 16 | #' } 17 | #' @export 18 | url_check <- function( 19 | path = ".", 20 | db = NULL, 21 | parallel = TRUE, 22 | pool = curl::new_pool(), 23 | progress = TRUE 24 | ) { 25 | opts <- options(timeout = 5) 26 | on.exit(options(opts)) 27 | 28 | if (is.null(db)) { 29 | db <- with_pandoc_available( 30 | rbind( 31 | tools$url_db_from_package_sources(normalizePath(path)), 32 | url_db_from_package_rmd_vignettes(normalizePath(path)) 33 | ) 34 | ) 35 | } 36 | 37 | res <- tools$check_url_db( 38 | db, 39 | parallel = parallel, 40 | pool = pool, 41 | verbose = progress 42 | ) 43 | if (NROW(res) > 0) { 44 | res$root <- normalizePath(path) 45 | } 46 | class(res) <- c("urlchecker_db", class(res)) 47 | res 48 | } 49 | 50 | #' @export 51 | print.urlchecker_db <- function(x, ...) { 52 | if (NROW(x) == 0) { 53 | cli::cli_alert_success("All URLs are correct!") 54 | return(invisible(x)) 55 | } 56 | 57 | for (row in seq_len(NROW(x))) { 58 | cran <- x[["CRAN"]][[row]] 59 | if (nzchar(cran)) { 60 | status <- "Error" 61 | message <- "CRAN URL not in canonical form" 62 | url <- cran 63 | new <- "" 64 | } else { 65 | status <- x[["Status"]][[row]] 66 | message <- x[["Message"]][[row]] 67 | url <- x[["URL"]][[row]] 68 | new <- x[["New"]][[row]] 69 | } 70 | root <- x[["root"]][[row]] 71 | from <- x[["From"]][[row]] 72 | 73 | for (file in from) { 74 | file_path <- file.path(root, file) 75 | data <- readLines(file_path) 76 | match <- regexpr(url, data, fixed = TRUE) 77 | lines <- which(match != -1) 78 | starts <- match[match != -1] 79 | ends <- starts + attr(match, "match.length")[match != -1] 80 | for (i in seq_along(lines)) { 81 | pointer <- paste0( 82 | strrep(" ", starts[[i]] - 1), 83 | "^", 84 | strrep("~", ends[[i]] - starts[[i]] - 1) 85 | ) 86 | if (nzchar(new)) { 87 | fix_it <- paste0(strrep(" ", starts[[i]] - 1), new) 88 | cli::cli_alert_warning( 89 | " 90 | {.strong Warning:} {file}:{lines[[i]]}:{starts[[i]]} {.emph Moved} 91 | {data[lines[[i]]]} 92 | {pointer} 93 | {fix_it} 94 | " 95 | ) 96 | } else { 97 | cli::cli_alert_danger( 98 | " 99 | {.strong Error:} {file}:{lines[[i]]}:{starts[[i]]} {.emph {status}: {message}} 100 | {data[lines[[i]]]} 101 | {pointer} 102 | " 103 | ) 104 | } 105 | } 106 | } 107 | } 108 | 109 | invisible(x) 110 | } 111 | -------------------------------------------------------------------------------- /R/url_update.R: -------------------------------------------------------------------------------- 1 | #' Update URLs in a package 2 | #' 3 | #' First uses [url_check] to check and then updates any URLs which are permanent (301) 4 | #' redirects. 5 | #' 6 | #' @param path Path to the package 7 | #' @param results results from [url_check]. 8 | #' @return The results from `url_check(path)`, invisibly. 9 | #' @examples 10 | #' \dontrun{ 11 | #' url_update("my_pkg") 12 | #' } 13 | #' @export 14 | url_update <- function(path = ".", results = url_check(path)) { 15 | can_update <- vlapply(results[["New"]], nzchar) 16 | to_update <- results[can_update, ] 17 | for (row in seq_len(NROW(to_update))) { 18 | old <- to_update[["URL"]][[row]] 19 | new <- to_update[["New"]][[row]] 20 | root <- to_update[["root"]][[row]] 21 | if (nzchar(new)) { 22 | from <- to_update[["From"]][[row]] 23 | if (("README.md" %in% from) && file.exists("README.Rmd")) { 24 | from <- c(from, "README.Rmd") 25 | } 26 | for (file in from) { 27 | file_path <- file.path(root, file) 28 | data <- readLines(file_path) 29 | data <- gsub(old, new, data, fixed = TRUE) 30 | writeLines(data, file_path) 31 | cli::cli_alert_success( 32 | "{.strong Updated:} {.url {old}} to {.url {new}} in {.file {file}}" 33 | ) 34 | } 35 | } 36 | } 37 | 38 | print(results[!can_update, ]) 39 | 40 | invisible(results) 41 | } 42 | -------------------------------------------------------------------------------- /R/urlchecker-package.R: -------------------------------------------------------------------------------- 1 | #' @keywords internal 2 | "_PACKAGE" 3 | 4 | ## usethis namespace: start 5 | ## usethis namespace: end 6 | NULL 7 | -------------------------------------------------------------------------------- /R/utils.R: -------------------------------------------------------------------------------- 1 | vlapply <- function(x, f, ...) vapply(x, f, logical(1)) 2 | 3 | # makes sure that pandoc is available 4 | # puts RStudio's pandoc on the PATH if it is the only one available 5 | with_pandoc_available <- function(code) { 6 | pandoc_location <- Sys.which("pandoc") 7 | if (!nzchar(pandoc_location)) { 8 | pandoc_path <- Sys.getenv("RSTUDIO_PANDOC") 9 | if (!nzchar(pandoc_path)) { 10 | stop("pandoc is not installed and on the PATH") 11 | } else { 12 | sys_path <- Sys.getenv("PATH") 13 | on.exit(Sys.setenv("PATH" = sys_path)) 14 | Sys.setenv( 15 | "PATH" = paste(pandoc_path, sys_path, sep = .Platform$path.sep) 16 | ) 17 | } 18 | } 19 | force(code) 20 | } 21 | 22 | 23 | update_urltools <- function() { 24 | lines <- readLines( 25 | "https://raw.githubusercontent.com/wch/r-source/trunk/src/library/tools/R/urltools.R" 26 | ) 27 | writeLines(lines, "inst/tools/urltools.R") 28 | } 29 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | tools <- new.env(parent = asNamespace("tools")) 2 | 3 | .onLoad <- function(...) { 4 | source( 5 | file = system.file( 6 | file.path("tools", "urltools.R"), 7 | package = "urlchecker" 8 | ), 9 | local = tools 10 | ) 11 | if (getRversion() < "4.0.0") { 12 | source( 13 | file = system.file(file.path("tools", "utils.R"), package = "urlchecker"), 14 | local = tools 15 | ) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # urlchecker 2 | 3 | 4 | [![R-CMD-check](https://github.com/r-lib/urlchecker/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/urlchecker/actions/workflows/R-CMD-check.yaml) 5 | [![Codecov test coverage](https://codecov.io/gh/r-lib/urlchecker/graph/badge.svg)](https://app.codecov.io/gh/r-lib/urlchecker) 6 | 7 | 8 | The goal of urlchecker is to run the URL checks from R 4.1 in older versions of R and automatically update URLs as needed. 9 | 10 | It also uses concurrent requests, so is generally much faster than the URL checks from the tools package. 11 | 12 | ## Installation 13 | 14 | Install the released version from CRAN 15 | 16 | ```r 17 | install.packages("urlchecker") 18 | ``` 19 | 20 | Or the development version from GitHub: 21 | 22 | ```r 23 | # install.packages("pak") 24 | pak::pak("r-lib/urlchecker") 25 | ``` 26 | 27 | ## Usage 28 | 29 | ``` r 30 | library(urlchecker) 31 | 32 | # `url_check()` will check all URLs in a package, as is done by CRAN when 33 | # submitting a package. 34 | url_check("path/to/pkg") 35 | 36 | # `url_update()` will check all URLs in a package, then update any 301 37 | # redirects automatically to their new location. 38 | url_update("path/to/pkg") 39 | ``` 40 | 41 | ## Code of Conduct 42 | 43 | Please note that the urlchecker project is released with a 44 | [Contributor Code of Conduct](https://r-lib.github.io/urlchecker/CODE_OF_CONDUCT.html). 45 | By contributing to this project, you agree to abide by its terms. 46 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://urlchecker.r-lib.org/ 2 | 3 | template: 4 | package: tidytemplate 5 | bootstrap: 5 6 | 7 | includes: 8 | in_header: | 9 | 10 | 11 | development: 12 | mode: auto 13 | -------------------------------------------------------------------------------- /air.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-lib/urlchecker/134245d37ab3a78dc00f2e42b41114d806e5a553/air.toml -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | informational: true 10 | patch: 11 | default: 12 | target: auto 13 | threshold: 1% 14 | informational: true 15 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-lib/urlchecker/134245d37ab3a78dc00f2e42b41114d806e5a553/cran-comments.md -------------------------------------------------------------------------------- /inst/tools/README.md: -------------------------------------------------------------------------------- 1 | Re-generate `urltools.R` with `update_urltools()`. 2 | -------------------------------------------------------------------------------- /inst/tools/urltools.R: -------------------------------------------------------------------------------- 1 | # File src/library/tools/R/urltools.R 2 | # Part of the R package, https://www.R-project.org 3 | # 4 | # Copyright (C) 2015-2023 The R Core Team 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # A copy of the GNU General Public License is available at 17 | # https://www.R-project.org/Licenses/ 18 | 19 | ## See RFC 3986 and 20 | ## . 21 | 22 | get_IANA_URI_scheme_db <- 23 | function() { 24 | ## See 25 | ## . 26 | baseurl <- "https://www.iana.org/assignments/uri-schemes/" 27 | db <- utils::read.csv( 28 | url(paste0(baseurl, "uri-schemes-1.csv")), 29 | stringsAsFactors = FALSE, 30 | encoding = "UTF-8" 31 | ) 32 | names(db) <- chartr(".", "_", names(db)) 33 | db$URI_Scheme <- sub(" .*", "", db$URI_Scheme) 34 | db 35 | } 36 | 37 | parse_URI_reference <- 38 | function(x) { 39 | re <- "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?" 40 | if (length(x)) { 41 | y <- do.call(rbind, regmatches(x, regexec(re, x))) 42 | y <- y[, c(3, 5, 6, 8, 10), drop = FALSE] 43 | } else { 44 | y <- matrix(character(), 0L, 5L) 45 | } 46 | colnames(y) <- c("scheme", "authority", "path", "query", "fragment") 47 | y 48 | } 49 | 50 | .get_urls_from_Rd <- 51 | function(x, href = TRUE, ifdef = FALSE) { 52 | urls <- character() 53 | recurse <- function(e) { 54 | tag <- attr(e, "Rd_tag") 55 | ## Rd2HTML and Rd2latex remove whitespace and \n from URLs. 56 | if (identical(tag, "\\url")) { 57 | urls <<- c(urls, lines2str(.Rd_deparse(e, tag = FALSE))) 58 | } else if (href && identical(tag, "\\href")) { 59 | ## One could also record the \href text argument in the 60 | ## names, but then one would need to process named and 61 | ## unnamed extracted URLs separately. 62 | urls <<- c(urls, lines2str(.Rd_deparse(e[[1L]], tag = FALSE))) 63 | } else if (ifdef && length(tag) && (tag %in% c("\\if", "\\ifelse"))) { 64 | ## cf. testRdConditional() 65 | condition <- e[[1L]] 66 | if (all(RdTags(condition) == "TEXT")) { 67 | if ( 68 | any( 69 | c("TRUE", "html") %in% 70 | trimws(strsplit(paste(condition, collapse = ""), ",")[[1L]]) 71 | ) 72 | ) 73 | recurse(e[[2L]]) else if (tag == "\\ifelse") recurse(e[[3L]]) 74 | } 75 | } else if (is.list(e)) lapply(e, recurse) 76 | } 77 | lapply(x, recurse) 78 | unique(trimws(urls)) 79 | } 80 | 81 | .get_urls_from_HTML_file <- 82 | function(f) { 83 | doc <- xml2::read_html(f) 84 | if (!inherits(doc, "xml_node")) return(character()) 85 | nodes <- xml2::xml_find_all(doc, "//a") 86 | hrefs <- xml2::xml_attr(nodes, "href") 87 | unique(hrefs[!is.na(hrefs) & !startsWith(hrefs, "#")]) 88 | } 89 | 90 | .get_urls_from_PDF_file <- 91 | function(f) { 92 | ## Seems there is no straightforward way to extract hyperrefs from a 93 | ## PDF, hence first convert to HTML. 94 | ## Note that pdftohtml always outputs in cwd ... 95 | owd <- getwd() 96 | dir.create(d <- tempfile()) 97 | on.exit({ 98 | unlink(d, recursive = TRUE) 99 | setwd(owd) 100 | }) 101 | file.copy(normalizePath(f), d) 102 | setwd(d) 103 | g <- tempfile(tmpdir = d, fileext = ".xml") 104 | system2( 105 | "pdftohtml", 106 | c("-s -q -i -c -xml", shQuote(basename(f)), shQuote(basename(g))) 107 | ) 108 | ## Oh dear: seems that pdftohtml can fail without a non-zero exit 109 | ## status. 110 | if (file.exists(g)) .get_urls_from_HTML_file(g) else character() 111 | } 112 | 113 | url_db <- 114 | function(urls, parents) { 115 | ## Some people get leading LFs in URLs, so trim before checking. 116 | db <- list2DF(list( 117 | URL = trimws(as.character(urls)), 118 | Parent = as.character(parents) 119 | )) 120 | class(db) <- c("url_db", "data.frame") 121 | db 122 | } 123 | 124 | url_db_from_HTML_files <- 125 | function(dir, recursive = FALSE, files = NULL, verbose = FALSE) { 126 | urls <- parents <- character() 127 | if (is.null(files)) 128 | files <- list.files( 129 | dir, 130 | pattern = "[.]html$", 131 | full.names = TRUE, 132 | recursive = recursive 133 | ) 134 | urls <- 135 | lapply(files, function(f) { 136 | if (verbose) 137 | message(sprintf("processing %s", .file_path_relative_to_dir(f, dir))) 138 | .get_urls_from_HTML_file(f) 139 | }) 140 | names(urls) <- files 141 | urls <- Filter(length, urls) 142 | if (length(urls)) { 143 | parents <- rep.int( 144 | .file_path_relative_to_dir(names(urls), dir), 145 | lengths(urls) 146 | ) 147 | urls <- unlist(urls, use.names = FALSE) 148 | } 149 | url_db(urls, parents) 150 | } 151 | 152 | url_db_from_PDF_files <- 153 | function(dir, recursive = FALSE, files = NULL, verbose = FALSE) { 154 | urls <- parents <- character() 155 | if (is.null(files)) 156 | files <- list.files( 157 | dir, 158 | pattern = "[.]pdf$", 159 | full.names = TRUE, 160 | recursive = recursive 161 | ) 162 | urls <- 163 | lapply(files, function(f) { 164 | if (verbose) 165 | message(sprintf("processing %s", .file_path_relative_to_dir(f, dir))) 166 | .get_urls_from_PDF_file(f) 167 | }) 168 | names(urls) <- files 169 | urls <- Filter(length, urls) 170 | if (length(urls)) { 171 | parents <- rep.int( 172 | .file_path_relative_to_dir(names(urls), dir), 173 | lengths(urls) 174 | ) 175 | urls <- unlist(urls, use.names = FALSE) 176 | } 177 | url_db(urls, parents) 178 | } 179 | 180 | url_db_from_package_Rd_db <- 181 | function(db) { 182 | urls <- Filter(length, lapply(db, .get_urls_from_Rd)) 183 | url_db( 184 | unlist(urls, use.names = FALSE), 185 | rep.int(file.path("man", names(urls)), lengths(urls)) 186 | ) 187 | } 188 | 189 | url_db_from_package_metadata <- 190 | function(meta) { 191 | urls <- character() 192 | fields <- c("URL", "BugReports") 193 | for (v in meta[fields]) { 194 | if (is.na(v)) next 195 | pattern <- 196 | "<(URL: *)?((https?|ftp)://[^[:space:],]*)[[:space:]]*>" 197 | m <- gregexpr(pattern, v) 198 | urls <- c(urls, .gregexec_at_pos(pattern, v, m, 3L)) 199 | regmatches(v, m) <- "" 200 | pattern <- "(^|[^>\"])((https?|ftp)://[^[:space:],]*)" 201 | m <- gregexpr(pattern, v) 202 | urls <- c(urls, .gregexec_at_pos(pattern, v, m, 3L)) 203 | } 204 | if (!is.na(v <- meta["Description"])) { 205 | pattern <- 206 | "<(URL: *)?((https?|ftp)://[^[:space:]]+)[[:space:]]*>" 207 | m <- gregexpr(pattern, v) 208 | urls <- c(urls, .gregexec_at_pos(pattern, v, m, 3L)) 209 | regmatches(v, m) <- "" 210 | pattern <- 211 | "([^>\"])((https?|ftp)://[[:alnum:]/.:@+\\_~%#?=&;,-]+[[:alnum:]/])" 212 | m <- gregexpr(pattern, v) 213 | urls <- c(urls, .gregexec_at_pos(pattern, v, m, 3L)) 214 | regmatches(v, m) <- "" 215 | pattern <- "<([A-Za-z][A-Za-z0-9.+-]*:[^>]+)>" 216 | ## scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) 217 | m <- gregexpr(pattern, v) 218 | urls <- c(urls, .gregexec_at_pos(pattern, v, m, 2L)) 219 | } 220 | 221 | url_db(urls, rep.int("DESCRIPTION", length(urls))) 222 | } 223 | 224 | url_db_from_package_citation <- 225 | function(dir, meta, installed = FALSE) { 226 | urls <- character() 227 | path <- if (installed) "CITATION" else file.path("inst", "CITATION") 228 | cfile <- file.path(dir, path) 229 | if (file.exists(cfile)) { 230 | cinfo <- .read_citation_quietly(cfile, meta) 231 | if (!inherits(cinfo, "error")) 232 | urls <- trimws(unique(unlist(cinfo$url, use.names = FALSE))) 233 | } 234 | url_db(urls, rep.int(path, length(urls))) 235 | } 236 | 237 | url_db_from_package_news <- 238 | function(dir, installed = FALSE) { 239 | path <- if (installed) "NEWS.Rd" else file.path("inst", "NEWS.Rd") 240 | nfile <- file.path(dir, path) 241 | urls <- 242 | if (file.exists(nfile)) { 243 | macros <- initialRdMacros() 244 | .get_urls_from_Rd(prepare_Rd( 245 | parse_Rd(nfile, macros = macros), 246 | stages = "install" 247 | )) 248 | } else character() 249 | url_db(urls, rep.int(path, length(urls))) 250 | } 251 | 252 | url_db_from_package_HTML_files <- 253 | function(dir, installed = FALSE) { 254 | path <- if (installed) "doc" else file.path("inst", "doc") 255 | files <- Sys.glob(file.path(dir, path, "*.html")) 256 | if (installed && file.exists(rfile <- file.path(dir, "README.html"))) 257 | files <- c(files, rfile) 258 | url_db_from_HTML_files(dir, files = files) 259 | } 260 | 261 | url_db_from_package_README_md <- 262 | function(dir, installed = FALSE) { 263 | urls <- path <- character() 264 | rfile <- Filter( 265 | file.exists, 266 | c( 267 | if (!installed) file.path(dir, "inst", "README.md"), 268 | file.path(dir, "README.md") 269 | ) 270 | )[1L] 271 | if (!is.na(rfile) && nzchar(Sys.which("pandoc"))) { 272 | path <- .file_path_relative_to_dir(rfile, dir) 273 | tfile <- tempfile("README", fileext = ".html") 274 | on.exit(unlink(tfile)) 275 | out <- .pandoc_md_for_CRAN(rfile, tfile) 276 | if (!out$status) { 277 | urls <- .get_urls_from_HTML_file(tfile) 278 | } 279 | } 280 | url_db(urls, rep.int(path, length(urls))) 281 | } 282 | 283 | url_db_from_package_NEWS_md <- 284 | function(dir, installed = FALSE) { 285 | urls <- path <- character() 286 | nfile <- Filter( 287 | file.exists, 288 | c( 289 | if (!installed) file.path(dir, "inst", "NEWS.md"), 290 | file.path(dir, "NEWS.md") 291 | ) 292 | )[1L] 293 | if (!is.na(nfile) && nzchar(Sys.which("pandoc"))) { 294 | path <- .file_path_relative_to_dir(nfile, dir) 295 | tfile <- tempfile("NEWS", fileext = ".html") 296 | on.exit(unlink(tfile)) 297 | out <- .pandoc_md_for_CRAN(nfile, tfile) 298 | if (!out$status) { 299 | urls <- .get_urls_from_HTML_file(tfile) 300 | } 301 | } 302 | url_db(urls, rep.int(path, length(urls))) 303 | } 304 | 305 | url_db_from_package_sources <- 306 | function(dir, add = FALSE) { 307 | meta <- .get_package_metadata(dir, FALSE) 308 | db <- rbind( 309 | url_db_from_package_metadata(meta), 310 | url_db_from_package_Rd_db(Rd_db(dir = dir)), 311 | url_db_from_package_citation(dir, meta), 312 | url_db_from_package_news(dir) 313 | ) 314 | if (requireNamespace("xml2", quietly = TRUE)) { 315 | db <- rbind( 316 | db, 317 | url_db_from_package_HTML_files(dir), 318 | url_db_from_package_README_md(dir), 319 | url_db_from_package_NEWS_md(dir) 320 | ) 321 | } 322 | if (add) db$Parent <- file.path(basename(dir), db$Parent) 323 | db 324 | } 325 | 326 | url_db_from_installed_packages <- 327 | function(packages, lib.loc = NULL, verbose = FALSE) { 328 | if (!length(packages)) return() 329 | one <- function(p) { 330 | if (verbose) message(sprintf("processing %s", p)) 331 | dir <- system.file(package = p, lib.loc = lib.loc) 332 | if (dir == "") return() 333 | meta <- .read_description(file.path(dir, "DESCRIPTION")) 334 | rddb <- Rd_db(p, lib.loc = dirname(dir)) 335 | db <- rbind( 336 | url_db_from_package_metadata(meta), 337 | url_db_from_package_Rd_db(rddb), 338 | url_db_from_package_citation(dir, meta, installed = TRUE), 339 | url_db_from_package_news(dir, installed = TRUE) 340 | ) 341 | if (requireNamespace("xml2", quietly = TRUE)) { 342 | db <- rbind( 343 | db, 344 | url_db_from_package_HTML_files(dir, installed = TRUE), 345 | url_db_from_package_README_md(dir, installed = TRUE), 346 | url_db_from_package_NEWS_md(dir, installed = TRUE) 347 | ) 348 | } 349 | db$Parent <- file.path(p, db$Parent) 350 | db 351 | } 352 | do.call(rbind, c(lapply(packages, one), list(make.row.names = FALSE))) 353 | } 354 | 355 | get_IANA_HTTP_status_code_db <- 356 | function() { 357 | ## See 358 | ## 359 | baseurl <- "https://www.iana.org/assignments/http-status-codes/" 360 | db <- utils::read.csv( 361 | url(paste0(baseurl, "http-status-codes-1.csv")), 362 | stringsAsFactors = FALSE 363 | ) 364 | ## Drop "Unassigned". 365 | db[db$Description != "Unassigned", ] 366 | } 367 | 368 | ## See 369 | ## and , 370 | ## Section 4.2.2 "Numeric Order List of Reply Codes", 371 | ## and , 372 | ## Section 5 "New FTP Replies". 373 | ## Only need those >= 400. 374 | table_of_FTP_server_return_codes <- 375 | c( 376 | "421" = "Service not available, closing control connection.", 377 | "425" = "Can't open data connection.", 378 | "426" = "Connection closed; transfer aborted.", 379 | "430" = "Invalid username or password", 380 | "431" = "Need some unavailable resource to process security.", 381 | "434" = "Requested host unavailable.", 382 | "450" = "Requested file action not taken.", 383 | "451" = "Requested action aborted: local error in processing.", 384 | "452" = "Requested action not taken. Insufficient storage space in system.", 385 | "500" = "Syntax error, command unrecognized.", 386 | "501" = "Syntax error in parameters or arguments.", 387 | "502" = "Command not implemented.", 388 | "503" = "Bad sequence of commands.", 389 | "504" = "Command not implemented for that parameter.", 390 | "530" = "Not logged in.", 391 | "532" = "Need account for storing files.", 392 | "533" = "Command protection level denied for policy reasons.", 393 | "534" = "Request denied for policy reasons.", 394 | "535" = "Failed security check (hash, sequence, etc).", 395 | "536" = "Requested PROT level not supported by mechanism.", 396 | "537" = "Command protection level not supported by security mechanism.", 397 | "550" = "Requested action not taken. File unavailable", 398 | "551" = "Requested action aborted: page type unknown.", 399 | "552" = "Requested file action aborted. Exceeded storage allocation (for current directory or dataset).", 400 | "553" = "Requested action not taken. File name not allowed.", 401 | "631" = "Integrity protected reply.", 402 | "632" = "Confidentiality and integrity protected reply.", 403 | "633" = "Confidentiality protected reply." 404 | ) 405 | 406 | check_url_db <- 407 | function(db, remote = TRUE, verbose = FALSE, parallel = FALSE, pool = NULL) { 408 | use_curl <- 409 | !parallel && 410 | config_val_to_logical(Sys.getenv("_R_CHECK_URLS_USE_CURL_", "TRUE")) && 411 | requireNamespace("curl", quietly = TRUE) 412 | 413 | if (parallel && is.null(pool)) pool <- curl::new_pool() 414 | 415 | .gather <- function( 416 | u = character(), 417 | p = list(), 418 | s = rep.int("", length(u)), 419 | m = rep.int("", length(u)), 420 | new = rep.int("", length(u)), 421 | cran = rep.int("", length(u)), 422 | spaces = rep.int("", length(u)), 423 | R = rep.int("", length(u)) 424 | ) { 425 | y <- list2DF(list( 426 | URL = u, 427 | From = p, 428 | Status = s, 429 | Message = m, 430 | New = new, 431 | CRAN = cran, 432 | Spaces = spaces, 433 | R = R 434 | )) 435 | class(y) <- c("check_url_db", "data.frame") 436 | y 437 | } 438 | 439 | .fetch_headers <- 440 | if (parallel) 441 | function(urls) .fetch_headers_via_curl(urls, verbose, pool) else 442 | function(urls) .fetch_headers_via_base(urls, verbose) 443 | 444 | .check_ftp <- function(u, h) { 445 | if (inherits(h, "error")) { 446 | s <- "-1" 447 | msg <- sub("[[:space:]]*$", "", conditionMessage(h)) 448 | } else { 449 | s <- as.character(attr(h, "status")) 450 | msg <- table_of_FTP_server_return_codes[s] 451 | } 452 | c(s, msg, "", "") 453 | } 454 | 455 | .check_http <- if (remote) 456 | function(u, h) c(.check_http_A(u, h), .check_http_B(u)) else 457 | function(u, h) c(rep.int("", 3L), .check_http_B(u)) 458 | 459 | .check_http_A <- function(u, h) { 460 | newLoc <- "" 461 | if (inherits(h, "error")) { 462 | s <- "-1" 463 | msg <- sub("[[:space:]]*$", "", conditionMessage(h)) 464 | if ( 465 | grepl( 466 | paste( 467 | c( 468 | "server certificate verification failed", 469 | "failed to get server cert", 470 | "libcurl error code (51|60)" 471 | ), 472 | collapse = "|" 473 | ), 474 | msg 475 | ) 476 | ) { 477 | h2 <- tryCatch(curlGetHeaders(u, verify = FALSE), error = identity) 478 | s2 <- as.character(attr(h2, "status")) 479 | msg <- paste0( 480 | msg, 481 | "\n\t(Status without verification: ", 482 | table_of_HTTP_status_codes[s2], 483 | ")" 484 | ) 485 | } 486 | } else { 487 | s <- as.character(attr(h, "status")) 488 | msg <- table_of_HTTP_status_codes[s] 489 | } 490 | ## Look for redirected URLs 491 | ## According to 492 | ## the first 493 | ## line of a response is the status-line, with "a possibly empty 494 | ## textual phrase describing the status code", so only look for 495 | ## a 301 status code in the first line. 496 | if (grepl(" 301 ", h[1L], useBytes = TRUE)) { 497 | ## Get the new location from the last consecutive 301 498 | ## obtained. 499 | h <- split(h, c(0L, cumsum(h == "\r\n")[-length(h)])) 500 | i <- vapply(h, function(e) grepl(" 301 ", e[1L], useBytes = TRUE), NA) 501 | h <- h[[which(!i)[1L] - 1L]] 502 | pos <- grep("^[Ll]ocation: ", h, useBytes = TRUE) 503 | if (length(pos)) { 504 | loc <- sub("^[Ll]ocation: ([^\r]*)\r\n", "\\1", h[pos[1L]]) 505 | ## Ouch. According to RFC 7231, the location is a URI 506 | ## reference, and may be relative in which case it needs 507 | ## resolving against the effect request URI. 508 | ## . 509 | ## Not quite straightforward, hence do not report such 510 | ## 301s. 511 | ## (Alternatively, could try reporting the 301 but no 512 | ## new location.) 513 | newParts <- parse_URI_reference(loc) 514 | if (nzchar(newParts[1L, "scheme"])) { 515 | newLoc <- loc 516 | ## Handle fragments. If the new URL does have one, 517 | ## use it. Otherwise, if the old has one, use that. 518 | ## (From section 7.1.2). 519 | if (newParts[1L, "fragment"] == "") { 520 | uParts <- parse_URI_reference(u) 521 | if (nzchar(uFragment <- uParts[1L, "fragment"])) { 522 | newLoc <- paste0(newLoc, "#", uFragment) 523 | } 524 | } 525 | } 526 | } 527 | } 528 | ## 529 | if ((s != "200") && use_curl) { 530 | g <- .curl_GET_status(u) 531 | if (g == "200") { 532 | s <- g 533 | msg <- "OK" 534 | } 535 | } 536 | ## A mis-configured site 537 | if (s == "503" && any(grepl("www.sciencedirect.com", c(u, newLoc)))) 538 | s <- "405" 539 | c(s, msg, newLoc) 540 | } 541 | 542 | .check_http_B <- function(u) { 543 | ul <- tolower(u) 544 | cran <- ((grepl("^https?://cran.r-project.org/web/packages", ul) && 545 | !grepl( 546 | "^https?://cran.r-project.org/web/packages/([.[:alnum:]_]+(html|pdf|rds))?$", 547 | ul 548 | )) || 549 | (grepl( 550 | "^https?://cran.r-project.org/web/views/[[:alnum:]]+[.]html$", 551 | ul 552 | )) || 553 | startsWith(ul, "http://cran.r-project.org") || 554 | any(startsWith(ul, mirrors))) 555 | R <- grepl("^http://(www|bugs|journal).r-project.org", ul) 556 | spaces <- grepl(" ", u) 557 | c(if (cran) u else "", if (spaces) u else "", if (R) u else "") 558 | } 559 | 560 | bad <- .gather() 561 | 562 | if (!NROW(db)) return(bad) 563 | 564 | ## Could also use utils::getCRANmirrors(local.only = TRUE). 565 | mirrors <- c( 566 | utils::read.csv( 567 | file.path(R.home("doc"), "CRAN_mirrors.csv"), 568 | as.is = TRUE, 569 | encoding = "UTF-8" 570 | )$URL, 571 | "http://cran.rstudio.com/", 572 | "https://cran.rstudio.com/" 573 | ) 574 | mirrors <- tolower(sub("/$", "", mirrors)) 575 | 576 | if (inherits(db, "check_url_db")) { 577 | ## Allow re-checking check results. 578 | parents <- db$From 579 | urls <- db$URL 580 | } else { 581 | parents <- split(db$Parent, db$URL) 582 | urls <- names(parents) 583 | } 584 | 585 | parts <- parse_URI_reference(urls) 586 | 587 | ## Empty URLs. 588 | ind <- apply(parts == "", 1L, all) 589 | if (any(ind)) { 590 | len <- sum(ind) 591 | bad <- rbind( 592 | bad, 593 | .gather(urls[ind], parents[ind], m = rep.int("Empty URL", len)) 594 | ) 595 | } 596 | 597 | ## Invalid URI schemes. 598 | schemes <- parts[, 1L] 599 | ind <- is.na(match( 600 | tolower(schemes), 601 | c( 602 | "", 603 | IANA_URI_scheme_db$URI_Scheme, 604 | "arxiv", 605 | ## Also allow 'isbn' and 'issn', which in fact 606 | ## are registered URN namespaces but not 607 | ## registered URI schemes, see 608 | ## 609 | ## 610 | ## 611 | ## . 612 | "isbn", 613 | "issn", 614 | ## Also allow 'javascript' scheme, see 615 | ## 616 | ## (but apparently never registered with IANA). 617 | "javascript" 618 | ) 619 | )) 620 | if (any(ind)) { 621 | len <- sum(ind) 622 | msg <- rep.int("Invalid URI scheme", len) 623 | doi <- schemes[ind] == "doi" 624 | if (any(doi)) 625 | msg[doi] <- paste(msg[doi], "(use \\doi for DOIs in Rd markup)") 626 | bad <- rbind(bad, .gather(urls[ind], parents[ind], m = msg)) 627 | } 628 | 629 | ## Could check urn URIs at least for appropriate namespaces using 630 | ## 631 | 632 | ## ftp. 633 | pos <- which(schemes == "ftp") 634 | if (length(pos) && remote) { 635 | urlspos <- urls[pos] 636 | headers <- .fetch_headers(urlspos) 637 | results <- do.call(rbind, Map(.check_ftp, urlspos, headers)) 638 | status <- as.numeric(results[, 1L]) 639 | ind <- (status < 0L) | (status >= 400L) 640 | if (any(ind)) { 641 | pos <- pos[ind] 642 | s <- as.character(status[ind]) 643 | s[s == "-1"] <- "Error" 644 | m <- results[ind, 2L] 645 | m[is.na(m)] <- "" 646 | bad <- rbind(bad, .gather(urls[pos], parents[pos], s, m)) 647 | } 648 | } 649 | 650 | ## http/https. 651 | pos <- which(schemes == "http" | schemes == "https") 652 | if (length(pos) && remote) { 653 | urlspos <- urls[pos] 654 | ## Check DOI URLs via the DOI handle API, as we nowadays do for 655 | ## checking DOIs. 656 | myparts <- parts[pos, , drop = FALSE] 657 | ind <- (((myparts[, 2L] == "doi.org") | 658 | (myparts[, 2L] == "dx.doi.org")) & 659 | startsWith(myparts[, 3L], "/10.") & 660 | !nzchar(myparts[, 4L]) & 661 | !nzchar(myparts[, 5L])) 662 | if (any(ind)) 663 | urlspos[ind] <- paste0("https://doi.org/api/handles", myparts[ind, 3L]) 664 | ## Could also use regexps, e.g. 665 | ## pat <- "^https?://(dx[.])?doi.org/10[.]([^?#]+)$" 666 | ## ind <- grep(pat, urlspos) 667 | ## if(length(ind)) 668 | ## urlspos[ind] <- 669 | ## paste0("https://doi.org/api/handles/10.", 670 | ## sub(pat, "\\2", urlspos[ind])) 671 | ## but using the parts is considerably faster ... 672 | headers <- .fetch_headers(urlspos) 673 | results <- do.call(rbind, Map(.check_http, urlspos, headers)) 674 | status <- as.numeric(results[, 1L]) 675 | ## 405 is HTTP not allowing HEAD requests 676 | ## maybe also skip 500, 503, 504 as likely to be temporary issues 677 | ind <- is.na(match(status, c(200L, 405L, NA))) | 678 | nzchar(results[, 3L]) | 679 | nzchar(results[, 4L]) | 680 | nzchar(results[, 5L]) | 681 | nzchar(results[, 6L]) 682 | if (any(ind)) { 683 | pos <- pos[ind] 684 | s <- as.character(status[ind]) 685 | s[is.na(s)] <- "" 686 | s[s == "-1"] <- "Error" 687 | m <- results[ind, 2L] 688 | m[is.na(m)] <- "" 689 | bad <- rbind( 690 | bad, 691 | .gather( 692 | urls[pos], 693 | parents[pos], 694 | s, 695 | m, 696 | results[ind, 3L], 697 | results[ind, 4L], 698 | results[ind, 5L], 699 | results[ind, 6L] 700 | ) 701 | ) 702 | } 703 | } 704 | bad 705 | } 706 | 707 | format.check_url_db <- 708 | function(x, ...) { 709 | if (!NROW(x)) return(character()) 710 | 711 | u <- x$URL 712 | new <- x$New 713 | ind <- nzchar(new) 714 | if (any(ind)) { 715 | u[ind] <- sprintf("%s (moved to %s)", u[ind], new[ind]) 716 | if ( 717 | config_val_to_logical(Sys.getenv( 718 | "_R_CHECK_URLS_SHOW_301_STATUS_", 719 | "FALSE" 720 | )) 721 | ) { 722 | x$Message[ind] <- "Moved Permanently" 723 | x$Status[ind] <- "301" 724 | } 725 | } 726 | 727 | paste0( 728 | sprintf("URL: %s", u), 729 | sprintf("\nFrom: %s", vapply(x$From, paste, "", collapse = "\n ")), 730 | ifelse((s <- x$Status) == "", "", sprintf("\nStatus: %s", s)), 731 | ifelse( 732 | (m <- x$Message) == "", 733 | "", 734 | sprintf("\nMessage: %s", gsub("\n", "\n ", m, fixed = TRUE)) 735 | ), 736 | ifelse((m <- x$Spaces) == "", "", "\nURL contains spaces"), 737 | ifelse((m <- x$CRAN) == "", "", "\nCRAN URL not in canonical form"), 738 | ifelse((m <- x$R) == "", "", "\nR-project URL not in canonical form") 739 | ) 740 | } 741 | 742 | print.check_url_db <- 743 | function(x, ...) { 744 | if (NROW(x)) writeLines(paste(format(x), collapse = "\n\n")) 745 | invisible(x) 746 | } 747 | 748 | as.matrix.check_url_db <- 749 | function(x, ...) { 750 | n <- lengths(x[["From"]]) 751 | y <- do.call( 752 | cbind, 753 | c( 754 | list(URL = rep.int(x[["URL"]], n), Parent = unlist(x[["From"]])), 755 | lapply(x[-c(1L, 2L)], rep.int, n) 756 | ) 757 | ) 758 | rownames(y) <- NULL 759 | y 760 | } 761 | 762 | .fetch_headers_via_base <- 763 | function(urls, verbose = FALSE, ids = urls) 764 | Map( 765 | function(u, verbose, i) { 766 | if (verbose) message(sprintf("processing %s", i)) 767 | tryCatch(curlGetHeaders(u), error = identity) 768 | }, 769 | urls, 770 | verbose, 771 | ids 772 | ) 773 | 774 | .fetch_headers_via_curl <- 775 | function(urls, verbose = FALSE, pool = NULL) { 776 | out <- .curl_multi_run_worker(urls, TRUE, verbose, pool) 777 | ind <- !vapply(out, inherits, NA, "error") 778 | if (any(ind)) 779 | out[ind] <- lapply(out[ind], function(x) { 780 | y <- strsplit(rawToChar(x$headers), "(?<=\r\n)", perl = TRUE)[[1L]] 781 | attr(y, "status") <- x$status_code 782 | y 783 | }) 784 | out 785 | } 786 | 787 | 788 | .curl_multi_run_worker <- 789 | function(urls, nobody = FALSE, verbose = FALSE, pool = NULL) { 790 | ## Use 'nobody = TRUE' to fetch only headers. 791 | 792 | .progress_bar <- function(length, msg = "") { 793 | bar <- new.env(parent = baseenv()) 794 | if (is.null(length)) { 795 | length <- 0L 796 | } 797 | done <- fmt <- NULL # make codetools happy 798 | bar$length <- length 799 | bar$done <- -1L 800 | digits <- trunc(log10(length)) + 1L 801 | bar$fmt <- paste0("\r", msg, "[ %", digits, "i / %", digits, "i ]") 802 | bar$update <- function() { 803 | assign("done", inherits = TRUE, done + 1L) 804 | if (length <= 0L) { 805 | return() 806 | } 807 | if (done >= length) { 808 | cat("\r", strrep(" ", nchar(fmt)), "\r", sep = "") 809 | } else { 810 | cat(sprintf(fmt, done, length), sep = "") 811 | } 812 | } 813 | environment(bar$update) <- bar 814 | bar$update() 815 | bar 816 | } 817 | 818 | if (is.null(pool)) pool <- curl::new_pool() 819 | 820 | bar <- .progress_bar(if (verbose) length(urls), msg = "fetching ") 821 | 822 | out <- vector("list", length(urls)) 823 | 824 | for (i in seq_along(out)) { 825 | u <- urls[[i]] 826 | h <- curl::new_handle(url = u) 827 | curl::handle_setopt( 828 | h, 829 | nobody = nobody, 830 | cookiesession = 1L, 831 | followlocation = 1L, 832 | http_version = 2L, 833 | ssl_enable_alpn = 0L 834 | ) 835 | timeout <- as.integer(getOption("timeout")) 836 | if (!is.na(timeout) && (timeout > 0L)) 837 | curl::handle_setopt(h, connecttimeout = timeout, timeout = timeout) 838 | if ( 839 | grepl("^https?://github[.]com", u) && 840 | nzchar(a <- Sys.getenv("GITHUB_PAT", "")) 841 | ) { 842 | curl::handle_setheaders(h, "Authorization" = paste("token", a)) 843 | } 844 | handle_result <- local({ 845 | i <- i 846 | function(x) { 847 | out[[i]] <<- x 848 | bar$update() 849 | } 850 | }) 851 | handle_error <- local({ 852 | i <- i 853 | function(x) { 854 | out[[i]] <<- 855 | structure( 856 | list(message = x), 857 | class = c("curl_error", "error", "condition") 858 | ) 859 | bar$update() 860 | } 861 | }) 862 | curl::multi_add(h, done = handle_result, fail = handle_error, pool = pool) 863 | } 864 | 865 | curl::multi_run(pool = pool) 866 | 867 | out 868 | } 869 | 870 | .curl_GET_status <- 871 | function(u, verbose = FALSE) { 872 | if (verbose) message(sprintf("processing %s", u)) 873 | ## Configure curl handle for better luck with JSTOR URLs/DOIs. 874 | ## Alternatively, special-case requests to 875 | ## https?://doi.org/10.2307 876 | ## https?://www.jstor.org 877 | h <- curl::new_handle() 878 | curl::handle_setopt( 879 | h, 880 | cookiesession = 1, 881 | followlocation = 1, 882 | http_version = 2L, 883 | ssl_enable_alpn = 0 884 | ) 885 | timeout <- as.integer(getOption("timeout")) 886 | if (!is.na(timeout) && (timeout > 0L)) 887 | curl::handle_setopt(h, connecttimeout = timeout, timeout = timeout) 888 | if ( 889 | startsWith(u, "https://github.com") && 890 | nzchar(a <- Sys.getenv("GITHUB_PAT", "")) 891 | ) 892 | curl::handle_setheaders(h, "Authorization" = paste("token", a)) 893 | g <- tryCatch(curl::curl_fetch_memory(u, handle = h), error = identity) 894 | if (inherits(g, "error")) -1L else g$status_code 895 | } 896 | -------------------------------------------------------------------------------- /inst/tools/utils.R: -------------------------------------------------------------------------------- 1 | ### ** lines2str 2 | lines2str <- 3 | function(txt, sep = "") 4 | trimws(gsub( 5 | "\n", 6 | sep, 7 | paste(txt, collapse = sep), 8 | fixed = TRUE, 9 | useBytes = TRUE 10 | )) 11 | -------------------------------------------------------------------------------- /man/url_check.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/url_check.R 3 | \name{url_check} 4 | \alias{url_check} 5 | \title{Check urls in a package} 6 | \usage{ 7 | url_check( 8 | path = ".", 9 | db = NULL, 10 | parallel = TRUE, 11 | pool = curl::new_pool(), 12 | progress = TRUE 13 | ) 14 | } 15 | \arguments{ 16 | \item{path}{Path to the package} 17 | 18 | \item{db}{A url database} 19 | 20 | \item{parallel}{If \code{TRUE}, check the URLs in parallel} 21 | 22 | \item{pool}{A multi handle created by \code{\link[curl:multi]{curl::new_pool()}}. If \code{NULL} use a global pool.} 23 | 24 | \item{progress}{Whether to show the progress bar for parallel checks} 25 | } 26 | \value{ 27 | A \code{url_checker_db} object (invisibly). This is a \code{check_url_db} object 28 | with an added class with a custom print method. 29 | } 30 | \description{ 31 | Runs the \code{url_db_from_package_source} function in the tools package along 32 | with a function to check URLs in un-rendered Rmarkdown vignettes. 33 | } 34 | \examples{ 35 | \dontrun{ 36 | url_check("my_pkg") 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /man/url_update.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/url_update.R 3 | \name{url_update} 4 | \alias{url_update} 5 | \title{Update URLs in a package} 6 | \usage{ 7 | url_update(path = ".", results = url_check(path)) 8 | } 9 | \arguments{ 10 | \item{path}{Path to the package} 11 | 12 | \item{results}{results from \link{url_check}.} 13 | } 14 | \value{ 15 | The results from \code{url_check(path)}, invisibly. 16 | } 17 | \description{ 18 | First uses \link{url_check} to check and then updates any URLs which are permanent (301) 19 | redirects. 20 | } 21 | \examples{ 22 | \dontrun{ 23 | url_update("my_pkg") 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /man/urlchecker-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/urlchecker-package.R 3 | \docType{package} 4 | \name{urlchecker-package} 5 | \alias{urlchecker} 6 | \alias{urlchecker-package} 7 | \title{urlchecker: Run CRAN URL Checks from Older R Versions} 8 | \description{ 9 | Provide the URL checking tools available in R 4.1+ as a package for earlier versions of R. Also uses concurrent requests so can be much faster than the serial versions. 10 | } 11 | \seealso{ 12 | Useful links: 13 | \itemize{ 14 | \item \url{https://github.com/r-lib/urlchecker} 15 | \item \url{https://urlchecker.r-lib.org/} 16 | \item Report bugs at \url{https://github.com/r-lib/urlchecker/issues} 17 | } 18 | 19 | } 20 | \author{ 21 | \strong{Maintainer}: Gábor Csárdi \email{csardi.gabor@gmail.com} 22 | 23 | Authors: 24 | \itemize{ 25 | \item R Core team (The code in urltools.R adapted from the tools package) 26 | \item Jim Hester (\href{https://orcid.org/0000-0002-2739-7082}{ORCID}) 27 | } 28 | 29 | Other contributors: 30 | \itemize{ 31 | \item RStudio [copyright holder, funder] 32 | } 33 | 34 | } 35 | \keyword{internal} 36 | -------------------------------------------------------------------------------- /urlchecker.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: XeLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | --------------------------------------------------------------------------------