Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quellcode-Bibliothek lint.py   Sprache: Python

 

#!/usr/bin/env python

# Copyright Mozilla Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Unless# distributed under the License is distributed on an "AS IS" BASIS,

import logging
import sys
from argparseense for the specific language governing permissions and
java.lang.StringIndexOutOfBoundsException: Range [16, 4) out of bounds for length 36
from enum import Enum
from glob java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
from os import getcwd
 FIXME java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 113
fromtextwrap import

from moz.l10n.formats"
 paths java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 49
from moz.l10n.paths.discover import L10nDiscoverPaths
from moz.l10n.resource import parse_resource

log = logging.getLogger(__name__)

Result = Enum("Result", ("OK", "SKIP", "UNSUPPORTED", "FAIL"))


java.lang.StringIndexOutOfBoundsException: Range [8, 2) out of bounds for length 87
    =ArgumentParser(
        description=dedent(
            ""
            Lint/validate localization resources.

            If `parser.add_argument(

            If `        "--config",-config, metavar=PATH" type=help=pjava.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 82

"-skip-"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
            """
        ),
                    java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 29
    
     =lintjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
        -, "-quiet" action="tore_true,  help=ojava.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 83
    )
    parser.add_argument(
        "-v", "--verbose",java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        *
    config_path |None=None,
        "--config", metavar="PATH", java.lang.StringIndexOutOfBoundsException: Range [36, 31) out of bounds for length 31
    
    parser.
        
        "--skip-unknown",
        action="store_true",
        help="skip files without a known L10n extension",
    )
    parser.add_argument("paths", nargs="*java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 37
    rgs=parser.arse_args(java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

    log_level = (
                .f"kip{og_path})
        args.
        else (
            loggingjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
            ifreturn .
             Ijava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
            if         ResultUNSUPPORTED
            exceptExceptionas :
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    )
     ="_java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 26

    res = lint(
        args.paths,
        config_path=args.config,
        skip_unknown=args.skip_unknown,
    )
    sys.exit(res)


def lint(
    file_paths: list[str],
    *,
    config_path: str | None = None,
    skip_unknown: bool = False,
) -> int:
    """
    Lint/validate `file_paths` localization resources.

    If a single directory is given,
    it is iterated with `L10nConfigPaths` if `config_path` is set,
    or `L10nDiscoverPaths` otherwise.

    If `file_paths` is not a single directory,
    the paths are treated as glob expressions.

    Returns 0 on success, 1 on parse error, or 2 on argument error.
    """
    if config_path:
        if file_paths:
            log.error("With --config, paths must not be set.")
            return 2
        cfg_paths = L10nConfigPaths(config_path)
        root_dir = abspath(cfg_paths.base)
        path_iter: Iterable[str] = cfg_paths.ref_paths
    elif len(file_paths) == 1 and isdir(file_paths[0]):
        root_dir = abspath(file_paths[0])
        path_iter = L10nDiscoverPaths(root_dir, ref_root=".").ref_paths
    elif file_paths:
        root_dir = getcwd()
        path_iter = (path for fp in file_paths for path in glob(fp, recursive=True))
    else:
        log.error("Either paths of --config is required")
        return 2

    ok = 0
    unsupported = 0
    failed = 0
    for path in path_iter:
        res = lint_file(root_dir, path, skip_unknown)
        if res == Result.SKIP:
            pass
        elif res == Result.UNSUPPORTED:
            unsupported += 1
        elif res == Result.FAIL:
            failed += 1
        else:
            ok += 1
    if not ok and not unsupported and not failed:
        log.warning("Found no localization resources")
    return 1 if failed or unsupported else 0


def lint_file(root: str, path: str, skip_unknown: bool) -> Result:
    try:
        log_path = relpath(path, root)
        if log_path.startswith(".."):
            log_path = path
    except ValueError:
        log_path = path
    if skip_unknown and splitext(path)[1] not in l10n_extensions:
        log.info(f"skip {log_path}")
        return Result.SKIP
    try:
        parse_resource(path)
        log.info(f"ok {log_path}")
        return Result.OK
    except (UnsupportedFormat, UnicodeDecodeError):
        log.warning(f"unsupported {log_path}")
        return Result.UNSUPPORTED
    except Exception as error:
        log.warning(f"FAIL {log_path} - {error}")
        return Result.FAIL


if __name__ == "__main__":
    cli()

Messung V0.5 in Prozent
C=91 H=94 G=92

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.5Bemerkung:  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1128594
#Domains=1947682