Skip to content

Implement Format Devices - #7

Merged
iblancasa merged 2 commits into
masterfrom
formatters
Dec 13, 2016
Merged

iblancasa merged 2 commits into
masterfrom
formatters

Conversation

@pleonex

@pleonex pleonex commented Nov 11, 2016

Copy link
Copy Markdown
Contributor

Implement a new device that allows to show the parsed output in different format. The default and current implementation is Markdown but in the future we could implement XML or JSON devices.

@iblancasa iblancasa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good practice when you are programming in Python is adding the type of the parameters. For example:

def write_statistics_packets(self, state):
   """Write the packet statistics."""
   Params:
      +state (dict): state of blablabl...

Also, there are a lot of methods where the parameters are not in the documentation. Example:

def dict_regex_search(content, regex):
    """Apply the regex over all the fields of the dictionary."""
  CODE 

In this case, we should document what are content and regex parameters and what is their "mission"

def write_message(self, content, state):
"""Write the message.

The content argument is a dictionary with at least 'description' item.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is not a good idea to explain the "content" param in this way. Please, follow the same style as in the other functions

Comment thread src/devices/logger.py
"""Logger functions.

The module contains functions to log the new messages.
The 'content' dictionary is defined in the FormatDevice class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about how to describe this param but I think that this is not correct

class MarkdownFormatDevice(FormatDevice):
"""Format device for Markdown.

Functions:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Methods

The module contains the abstract class representation for a formatter of the
parsed logs.

Classes:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this comment it is not necessary: we only have a class in this file (with the same name of the class).

Comment thread src/__init__.py
# 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.
"""Package LogParser."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package LogParser or LogParser Packgage?

@pleonex

pleonex commented Dec 12, 2016 via email

Copy link
Copy Markdown
Contributor Author

@pleonex pleonex mentioned this pull request Dec 12, 2016
@pleonex

pleonex commented Dec 12, 2016

Copy link
Copy Markdown
Contributor Author

I have created #11 to track the documentation discussion. Do you agree to make these changes in other PR? If so, is there any change pending in this PR?

@iblancasa
iblancasa merged commit 5e6b602 into master Dec 13, 2016
@iblancasa

Copy link
Copy Markdown
Contributor

Perfect!

@pleonex
pleonex deleted the formatters branch December 13, 2016 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants