fireant-bot / fireant

Fireant is a Dependabot-like service (tailored to Apache Ant + Ivy projects) which creates pull requests to keep your dependencies secure and up-to-date.
https://github.com/fireant-bot/fireant
Apache License 2.0
1 stars 1 forks source link

DependencyFile class for xml parsing #1

Closed ufUNnxagpM closed 3 years ago

ufUNnxagpM commented 3 years ago

Class for editing dependencies of ivy.xml files (mainly, the rev tag of each dependency). I also made some changes to main.py, but they'll be overwritten by Jamie's changes (in the docker branch). Let me know if you have any suggested changes.

@lewismc

ufUNnxagpM commented 3 years ago

@lewismc The DependencyFile class accepts a path to an ivy.xml file when it's initialized. Once initialized, it builds a list of dependencies from the ivy.xml file and these can be modified with the modify_version(index, version) function. When all desired changes are made, the original file can be overwritten and updated with save().

The only part of the ivy.xml that must be "recreated" is the license header since the ElementTree library doesn't seem to support placing comments between <?xml version="1.0" ?> and <ivy-module version="1.0"> (see below). I've been looking into other xml libraries, mainly xml.dom.minidom, that may be able to preserve this portion, but haven't got around to it fully.

<?xml version="1.0" ?>

<!--
ElementTree doesn't support parsing of comments placed at the top here.
-->

<ivy-module version="1.0">
  ...
lewismc commented 3 years ago

Thanks for submitting this PR @MattTreadwell good work. Please merge and continue.

lewismc commented 3 years ago

At some stage we will go back and document all Classes and Functions. This is a fundamental requirements. We will also require unit tests for all code. Is this something you guys are working on?

ufUNnxagpM commented 3 years ago

@lewismc I've started documenting the major files in the codebase here. I haven't gotten around to describing each function, but I can add that. Jamie and I are starting to work on unit tests as well.

lewismc commented 3 years ago

Excellent. Thanks @MattTreadwell