Git Product home page Git Product logo

configparser's People

Contributors

tsugami avatar zachperkitny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

configparser's Issues

Space in section header

Consider the following

[REPLICA_SET] 
additional_directories = ['${JSONAR_LOCALDIR}/credentials', '${JSONAR_DATADIR}/sonarfinder/reports']

This crashes the parser.

If I were to patch:

const SECTION = new RegExp(/^\s*\[([^\]]+)]$/);

to

const SECTION = new RegExp(/^\s*\[([^\]]+)]\s*$/);

this fixes the problem.

"file" not defined if configparser is unable to parse file

In the line https://github.com/ZachPerkitny/configparser/blob/master/src/configparser.js#L265 and https://github.com/ZachPerkitny/configparser/blob/master/src/configparser.js#L258 you are reference the attribute file. The var is not defined and ends in exception if a parser error happens.

(node:8) UnhandledPromiseRejectionWarning: ReferenceError: file is not defined
    at /app/node_modules/configparser/src/configparser.js:263:45
    at Array.forEach (<anonymous>)
    at ConfigParser.parseLines (/app/node_modules/configparser/src/configparser.js:248:11)
    at ConfigParser.read (/app/node_modules/configparser/src/configparser.js:109:16)
    at Startup (/app/src/index.js:12:10)
    at Object.<anonymous> (/app/src/index.js:254:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)

Run mkdir if filepath is non existent

Let's assume we are in a folder with the path /home/development/codegenerator and want to create a file called config.ini in the folder /home/development/codegenerator/out/configuration/ and both of these folders are non existent. You'll receive an error because you need to create these folders by yourself.
I would suggest automatically creating these folders in future versions.

Fails to read a configuration with long lines

The parser fails when reading the following file:

[bumpversion]
current_version = 0.0.1
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-a(?P<pmr>\d+)(\.dev(?P<build>\d+))?)?
serialize = 
	{major}.{minor}.{patch}-a{pmr}.dev{build}
	{major}.{minor}.{patch}-a{pmr}
	{major}.{minor}.{patch}

[bumpversion:file:setup.py]

[bumpversion:file:test/__init__.py]

[bumpversion:file:hpha_synchronization/__init__.py]

[bumpversion:file:hpha_synchronization/docs/__init__.py]

[bumpversion:file:hpha_synchronization/_internal/__init__.py]

on the lines following the serialize key. The same file reads fine using the python https://docs.python.org/3/library/configparser.html package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.