jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/351188 )
Change subject: Remove jsonlint entirely
......................................................................
Remove jsonlint entirely
All repositories have been migrated to use npm / grunt-jsonlint.
Bug: T119973
Change-Id: I1833846aaf974a2a8d9691ac6a5a31258712242c
---
D bin/json-lint.php
1 file changed, 0 insertions(+), 85 deletions(-)
Approvals:
Hashar: Looks good to me, approved
jenkins-bot: Verified
diff --git a/bin/json-lint.php b/bin/json-lint.php
deleted file mode 100755
index 2eb1212..0000000
--- a/bin/json-lint.php
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env php
-<?php
-/**
-* Recursive JSON linter.
-*
-* Copyright © 2014, Antoine "hashar" Musso
-* Copyright © 2014, Wikimedia Foundaction Inc.
-*
-* Licensed under the GPLv2.
-*/
-
-$paths = array_slice( $argv, 1 );
-if ( count( $paths ) === 0 ) {
- print <<<EOF
-PHP based json linter
-
-Usage: $argv[0] [path [path] [...]]]
-
-EOF;
-}
-
-/**
- * Whether $file content can be decoded by json_decode().
- *
- * @param String $content JSON payload to decode
- * @return Boolean Whether json_decode() managed to decode JSON.
- */
-function lint_json_file( $file ) {
- $content = file_get_contents( $file );
- return null !== json_decode( $content );
-}
-
-# Reimplements json_last_error_msg() messages from PHP 5.5.8
-if ( !function_exists( 'json_last_error_msg' ) ) {
- function json_last_error_msg() {
- switch( json_last_error() ) {
- case JSON_ERROR_NONE:
- $msg = 'No error';
- break;
- case JSON_ERROR_DEPTH:
- $msg = 'Maximum stack depth exceeded';
- break;
- case JSON_ERROR_STATE_MISMATCH:
- $msg = 'State mismatch (invalid or malformed
JSON)';
- break;
- case JSON_ERROR_CTRL_CHAR:
- $msg = 'Control character error, possibly
incorrectly encoded';
- break;
- case JSON_ERROR_SYNTAX:
- $msg = 'Syntax error';
- break;
- case JSON_ERROR_UTF8:
- $msg = 'Malformed UTF-8 characters, possibly
incorrectly encoded';
- break;
- # Other cases were introduced in PHP 5.5.0 which has
json_last_error_msg()
- default:
- $msg = 'Unknown error';
- }
- return $msg;
- } # end of json_last_error_msg()
-}
-
-$exitCode = 0;
-foreach ( $paths as $path ) {
- # Find json files and normalizes them to an iterator of SplFileInfo
- if ( !is_dir( $path ) ) {
- $jsonFiles = array( new SplFileInfo( $path ) );
- } else { // Directory
- $iter = new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator( $path,
- FilesystemIterator::CURRENT_AS_FILEINFO
- )
- );
- $jsonFiles = new RegexIterator( $iter, '/\.json$/' );
- }
-
- foreach ( $jsonFiles as $file ) {
- $result = lint_json_file( $file->getPathname() );
- if ( !$result ) {
- $exitCode = 1;
- fwrite( STDERR, $file->getPathname() . ": " .
json_last_error_msg() . "\n" );
- }
- }
-}
-exit( $exitCode );
--
To view, visit https://gerrit.wikimedia.org/r/351188
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1833846aaf974a2a8d9691ac6a5a31258712242c
Gerrit-PatchSet: 1
Gerrit-Project: integration/jenkins
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits